InvalidStateCodeStatusCode: "status code is invalid for a specified state code"

The status reason you sent is not valid with the state you sent it with. The valid pairs are set per table, so check the definition in the environment that raised the error.

Answer first

The status reason on the request is not one that goes with the state on the request. Microsoft’s current SetStateRequest reference says the valid combinations of state and status values vary from table to table: for system tables they are listed in the table reference, and for custom tables you have to look at the table definition in your own environment.

So check the table definition in the environment that raised the error, not the one the code was written against. The valid pairs belong to that table’s definition there.

What the error means

Source: the Web Service Error Codes reference in the CRM 2011 SDK.

CRM 2011 documents this as InvalidStateCodeStatusCode, code 80048408, with the message:

State code is invalid or state code is valid but status code is invalid for a specified state code.

That message covers two separate mistakes, and it is worth knowing which one you have:

  1. The state itself is not valid for that table.
  2. The state is valid, but the status reason is not valid with it.

The same reference lists a broader ErrorInSetState (80040357), for when the status or status reason of a record could not be set at all.

Setting state, then and now

Sources: the SetStateRequest topic in the CRM 2011 SDK, and the current SetStateRequest reference.

In CRM 2011, SetStateRequest is the documented message for setting a record’s state, and the caller needs privileges on the record it names.

In the current reference, SetStateRequest is marked deprecated, and the guidance is to use UpdateRequest instead. Code carried forward from a 2011 system may still be calling it; the reference calls that deprecated, and this page does not go further than that.

What this page does not claim

Microsoft’s current web service error code reference did not list InvalidStateCodeStatusCode or ErrorInSetState when this page was checked, on 12 September 2026. So this page makes no claim about which error code or wording current Dataverse returns for the same mistake. If you have seen the current message, the feedback control below is the fastest way to get it added with a source.

Sources

  1. SetStateRequest Class (Microsoft.Crm.Sdk.Messages) Microsoft · · Primary, current docs Current reference. Marks SetStateRequest as deprecated in favour of UpdateRequest, and says valid state and status combinations vary by table: see the table reference for system tables, and the table definition for custom tables in your environment.
  2. Microsoft Dynamics CRM 2011 SDK (compiled help, CrmSdk2011.chm) Microsoft · Primary, archived Private archive: CRM-SDK-Rescue/2011-SDK_from_desk/SDK/CrmSdk2011.chm Microsoft's own SDK help for the 2011 release, from an owner-held copy. Static reading only; the package is never executed and is not part of this repository. Quote sparingly and cite; do not republish.