System.InvalidOperationException: Configuration HistoryListId was not found and a default value was not specified

Recently while working in a visual studio workflow for SharePoint online, I got the below error: An unhandled exception occurred during the execution of the workflow instance. Exception Details: System.InvalidOperationException: Configuration ‘HistoryListId’ was not found and a default value was not specified. And also I got another error which says: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.InvalidOperationException: Configuration ‘TaskListId’ was not found and a default value was not specified.

The full error message looks like below:

RequestorId: 38d4fd8d-3663-e39c-0000-000000000000. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.InvalidOperationException: Configuration ‘HistoryListId’ was not found and a default value was not specified. at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) Exception from activity GetConfigurationValue ParseGuid DynamicActivity<Guid> WriteToHistory Microsoft.SharePoint.WorkflowServices.Activities.OperatingWebContextScope Microsoft.SharePoint.WorkflowServices.Activities.WriteToHistory Sequence TrainingRequestAddin.TrainingRequestNotification.WorkflowXaml_715346fd_61ca_43fd_8c2c_5a6df723ed57

And

RequestorId: 38d4fd8d-3663-e39c-0000-000000000000. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.InvalidOperationException: Configuration ‘TaskListId’ was not found and a default value was not specified. at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) Exception from activity GetConfigurationValue ParseGuid DynamicActivity<Guid> Sequence Microsoft.SharePoint.WorkflowServices.Activities.OperatingWebContextScope Microsoft.SharePoint.WorkflowServices.Activities.SingleTask Sequence TrainingRequestAddin.TrainingRequestNotification.WorkflowXaml_715346fd_61ca_43fd_8c2c_5a6df723ed57

System.InvalidOperationException: Configuration HistoryListId was not found and a default value was not specified

Then we wanted to manually trigger the workflow also. So in the workflow properties, I select “Manual Start Enabled”. Now next time when I deployed the workflow I got the above error.

To resolve the issue, we need to choose the Task List and History List. Select the workflow and then click on properties. Then choose the History List and Task List like below:

System.InvalidOperationException: Configuration HistoryListId was not found and a default value was not specified
System.InvalidOperationException: Configuration HistoryListId was not found and a default value was not specified

Once you select the History and Task list, the error will not come.

Read some SharePoint workflow tutorials:

I hope this will be helpful, to fix error System.InvalidOperationException: Configuration HistoryListId was not found and a default value was not specified.

>