Often you see this error in your plugin or Webapi actions when you trying to play with the status and status reasons in microsoft dyamics crm.
so, lets understand this.
Suppose i have below status and status reasons:
as you can see there is a set of status reason you can only combine with and “Active” Statecode and some with “Inactive” statecode.
So ,if you have a status reason which belongs to an active statecode but you use it with an inactive statecode and vice versa, you will be presented with this error.
and in the error first line you can actually see what optionset value it is talking about.
i hope this helps.
Cheers!