Wrong argument type for function

When double-clicking on a record in a list page to see the details of that record in a task page/form and getting this error:
Error executing code: Wrong argument type for function.

With a stack trace of:

(C)\Classes\QueryRun\setRecord

(C)\Classes\FormDataSource\executeQuery

Change the query used on your task page.  The cause is a table being present in the data sources for the task page but not in the query for the list page.  When the query is copied over from the list page by the SysListPageHelper class to the task page it leaves the additional table in the opened form without any data because the table didn’t exist in the query from the list page.  That datasource then throws the error message because the current record cannot be determined. 

To avoid this error in the task page/form if possible set the join type to Delayed on the additional data source.  Then the record doesn’t need to be loaded right away by the query.  If the query on the task page can not be modified change the list page so that it includes the additional table.