SharePoint ListData.svc 500 Error

If you’re fighting with the SharePoint ListData.svc with an odd error:

An error occurred while processing this request.

And you are using an OData operator like endswith, you may encounter this error and be puzzled with why it works for some fields but not others.

Tried various theories — indexed column?  use the column in a view?  maybe error with the column? — with no love until Rob thought that it might have to do with empty values.

Turns out that the underlying implementation of ListData.svc doesn’t quite like it if you have un-set or “null” values in your text fields.  So a query like this:

Will fail if there is an item in the list with an empty value for PrimaryFaxNumber.

However, using a nullity check will fix the issue:

You may also like...