I have been pulling my hair out over the last few days to resolve this issue.
I tried some of the suggestions:
1. make sure that the User Profile Service is up to date and make sure that a full synchronization has run.
2. make sure that the initiator accounts have access to Worflow History
3. make sure that the Doc library does not require checkout (or that your code handles it)
However the real solution to my problem came from SharePoint permissions. I had overridden the base permissions the on the Workflow Tasks list and the lists hosting the workflows and it seems that this caused the problem.
Once I reverted to the parents' permissions, the error disappeared.
The next problem was allowing users to approve their tasks. By default, users did not have 'approve' permissions on the list, so I needed to add a little code to my 'Tasks' web part to solve the problem; I gave the current user 'contribute' permissions on the list item so it could be moderated.
using (SPWeb inner = new SPSite(dr["EncodedAbsUrl"].ToString()).OpenWeb())
string relativeUrl = dr["FileRef"].ToString().Substring(dr["FileRef"].ToString().IndexOf("#") + 1);
relativeUrl = relativeUrl.Substring(0, relativeUrl.LastIndexOf("/"));
SPList list = inner.GetList(dr["EncodedAbsUrl"] + relativeUrl);
SPListItem item = list.GetItemById(int.Parse(dr["ID"].ToString()));
SPRoleDefinition RoleDefinition = web.RoleDefinitions.GetByType(SPRoleType.Contributor);
SPUser user = SPContext.Current.Web.CurrentUser;
SPRoleAssignment RoleAssignment = new SPRoleAssignment(user.LoginName, user.Email, user.Name, "notes");
inner.AllowUnsafeUpdates = true;
inner.AllowUnsafeUpdates = false;