troubleshoot-error-codes
When to use
Look up a Studio error or warning by its code and route to the specialist that fixes it. Use when the user's text has an UPPER_SNAKE code such as HOST_UNUSABLE or BINDING_PATH_MISSING, a [Contentstack Studio] CODE: log line, or a Studio API error_code number. Phrases: "error code", "what does … mean", "Studio threw …", "error_code 32". For messages with no code, use troubleshoot-error-messages. For a symptom with no code or message, use troubleshoot.
Studio error codes: class, status, first fix, specialist
Read the row for the code, apply the first fix if it's clear, then Read the specialist named in the row for the full diagnosis. Each code has a full entry, with every cause and fix, at https://studio-documentation.contentstackapps.com/reference/error-message-index#<CODE>.
SDK error codes
The SDK throws these. The error carries error.code and error.errorClass. Answer NOT_FOUND with a 404 and every other class with a 5xx. Decide with isCompositionNotFound(error) from @contentstack/studio-react, never with a list of names.
| Code | Class | Site answers | What it means | First fix | Specialist |
|---|---|---|---|---|---|
API_KEY_MISSING | SETUP_INCOMPLETE | 5xx | Your site isn't giving Studio an API key | Set the API key. | install-studio, then verify-setup |
COMPONENT_NOT_REGISTERED | SETUP_INCOMPLETE | 5xx | A component isn't registered | Built-ins missing: import @contentstack/studio-react once, before the fetch. Your own: register before you fetch, or register the missing component. | register-component |
COMPOSITION_IDENTIFIER_MISSING | SETUP_INCOMPLETE | 5xx | Your site didn't say which template it wanted | Name the template in the call. | setup-template-preview-routes |
DELIVERY_TOKEN_MISSING | SETUP_INCOMPLETE | 5xx | Your site isn't giving Studio a delivery token | Set the delivery token. | install-studio, then verify-setup |
ENVIRONMENT_MISSING | SETUP_INCOMPLETE | 5xx | Your site isn't telling Studio which environment to read | Set the environment. | install-studio, then verify-setup |
INIT_NOT_COMPLETE | SETUP_INCOMPLETE | 5xx | Your site asked for a template before Studio was ready | Call studioSdk.init(...) on this code path. | install-studio, then verify-setup |
STACK_SDK_MISSING | SETUP_INCOMPLETE | 5xx | Your site isn't giving Studio a Contentstack stack | Pass a stack to Studio. | install-studio, then verify-setup |
CONTENT_TYPE_NOT_FOUND | SETUP_INVALID | 5xx | Studio's content types are missing | Set contentTypeUid to Studio's content type UID (or fix its spelling), or install Studio's content types on that stack. | configure-studio, or provision-studio-project to install the content type |
ENVIRONMENT_NOT_FOUND | SETUP_INVALID | 5xx | Contentstack can't find that environment | Check the name. | install-studio / configure-studio |
HOST_UNUSABLE | SETUP_INVALID | 5xx | Your site points at a Contentstack address it can't use | Check it's a valid address. | install-studio / configure-studio |
LOCALE_NOT_CONFIGURED | SETUP_INVALID | 5xx | This language isn't set up | Check the code matches exactly. | install-studio / configure-studio |
STACK_NOT_FOUND_ON_HOST | SETUP_INVALID | 5xx | The API key doesn't lead to a stack | Check the API key. | install-studio / configure-studio |
TRANSPORT_FAILED | NETWORK_ERROR | 5xx | Your site couldn't reach Contentstack | Try again. | troubleshoot-composition-resolution |
RESPONSE_UNUSABLE | SERVER_ERROR | 5xx | Something other than Contentstack answered | Check what sits in between. | troubleshoot-composition-resolution |
SEARCH_INCOMPLETE | SERVER_ERROR | 5xx | Studio stopped searching before it finished | Contact Contentstack support. | troubleshoot-composition-resolution |
SPEC_UNREADABLE | SERVER_ERROR | 5xx | A stored layout won't open | Contact Contentstack support. | troubleshoot-composition-resolution |
UPSTREAM_ERROR | SERVER_ERROR | 5xx | Contentstack couldn't answer | Try again in a few minutes. | troubleshoot-composition-resolution |
URL_OWNERSHIP_PROBE_FAILED | SERVER_ERROR | 5xx | Studio couldn't tell which template owns this address | Try again shortly. | troubleshoot-composition-resolution |
COMPOSITION_UID_NOT_FOUND | NOT_FOUND | 404 | That template isn't here | Check the UID. | troubleshoot-composition-resolution |
CONNECTED_ENTRY_NOT_FOUND | NOT_FOUND | 404 | This template has no content to show | Check there's an entry. | troubleshoot-composition-resolution |
NO_COMPOSITION_FOR_TEMPLATE_CONTENT_TYPE | NOT_FOUND | 404 | No template uses this content type | Connect a template. | troubleshoot-composition-resolution |
NO_COMPOSITION_FOR_URL | NOT_FOUND | 404 | Nothing is set up for this address | Check the address. | troubleshoot-composition-resolution |
NO_PRIMARY_TEMPLATE_FOR_SECONDARY | NOT_FOUND | 404 | Secondary templates here, but no primary one | Deploy a secondary one from Studio: it becomes primary. | troubleshoot-composition-resolution |
REQUESTED_COMPOSITION_UNAVAILABLE | NOT_FOUND | 404 | A cs-template link this address can't show | Check the UID, and that it's deployed here as secondary. | troubleshoot-composition-resolution |
URL_LOCALE_NOT_FOUND | NOT_FOUND | 404 | The language in this address isn't set up | Check the address. | troubleshoot-composition-resolution |
URL_MATCHED_NO_ENTRY | NOT_FOUND | 404 | This address has no content behind it | Check there's an entry at this address. | troubleshoot-composition-resolution |
Warnings (logged, not thrown)
The page renders, but something on it is blank. The SDK logs these in development, and in production only with debug: true in studioSdk.init. Never answer them with a 404 or 5xx.
| Code | What it means | Specialist |
|---|---|---|
BINDING_PATH_MISSING | The field was renamed or removed on the content type, or it's empty on this entry. | troubleshoot-data-binding |
BINDING_SHAPE_MISMATCH | The binding points at a group or modular block. Point it at a field inside it. | troubleshoot-data-binding |
REFERENCES_UNRESOLVED | The references nest deeper than one request follows, or a referenced entry was deleted. | resolve-reference-depth |
FEWER_ENTRIES_THAN_REQUESTED | The missing entries aren't published to this environment, or they were deleted. | troubleshoot-data-binding |
QUERY_RETURNED_NO_ROWS | A pinned query ran and its filter matched nothing. | pin-query |
QUERY_REQUEST_FAILED | A pinned query's request didn't complete. Its filter isn't the problem. Retry the page. | pin-query |
DATA_SOURCES_UNREADABLE | The composition's saved data sources are damaged. Report it to Contentstack. | troubleshoot-data-binding |
PREVIEW_ASSET_PROJECTION_NULL | A known Preview API defect. Check the published site before you change the binding. | troubleshoot-data-binding |
Studio API error_codes
The Studio API returns error_message and error_code. Branch on error_code, never on the message text. A 400 (bad body or query) and a 408 (call ran longer than 60 seconds) carry no error_code.
| Status | error_code | error_message | What's wrong | Specialist |
|---|---|---|---|---|
401 | 39 | Missing Contentstack credentials — the request must include an authtoken or an OAuth access token (authorization: Bearer <token>) to create or read compositions | A composition call reached the API with neither an authtoken nor an authorization: Bearer token. The API checks this after it finds the project and checks your stack access, so another error can come first. | authenticate-cma |
401 | 48 | Missing Contentstack credentials — the request must include an authtoken or an OAuth access token (authorization: Bearer <token>) to list registered components | The same, on the registered components route. | authenticate-cma |
404 | 1 | Project not found | No project with that UID in this organization, or you can't read it. errors is { "uid": ["is not valid."] }. Composition and registered component routes return this too when the project in the path doesn't exist. | use-compositions-api / author-composition-via-api |
404 | 30 | Composition not found | No composition with that UID in the project's stack. errors is { "uid": ["is not valid."] }. | use-compositions-api / author-composition-via-api |
409 | 33 | A composition with this composable_uid already exists | Another composition in the content type already has this composable_uid, in any language. errors is { "composable_uid": ["is not unique."] }. | use-compositions-api / author-composition-via-api |
409 | 47 | A composition with this … already exists | Another composition already has a value that must be unique, such as the same title. errors names the field. | use-compositions-api / author-composition-via-api |
409 | 41 | This composition is referenced by other compositions and cannot be deleted | You deleted a composition that another composition uses. errors.references lists them. See "Why deleting a composition fails with 409" on the API errors page. | use-compositions-api / author-composition-via-api |
422 | 21 | Stack not found | Your token has no access to the project's connected stack: read access for a GET, write access for anything else. The API gets only a yes or no from the access check, so it can't tell a stack you can't access from one that doesn't exist. Reading a project you can't access answers 404 with code 1 instead. | authenticate-cma |
422 | 32 | The composition is invalid | The layout breaks a rule. errors lists every problem at once. See "Layout rules the API checks on every write" on the same page. The API also returns it when you send a blank composable_uid. | use-compositions-api / author-composition-via-api |
422 | 40 | composable_uid is immutable and cannot be changed on update | A PUT sent a composable_uid different from the stored one. | use-compositions-api / author-composition-via-api |
422 | 37 | Failed to decompress the composition UI spec | You asked for decompression=true, but the stored ui can't be read. errors is { "ui": ["is not valid."] }. | use-compositions-api / author-composition-via-api |
422 | 2 (create), 3 (change), 4 (delete) | An Error occurred while creating the project, and the same for updating or deleting | The API couldn't save the project. When a value must be unique, such as a second live project with the same stack and content type, errors names the field with is not unique. | use-compositions-api / author-composition-via-api |
422 | 70 | This template can't be published yet. … | Another template is primary at the URL. Send resolutions, not fixes: docs/20-tools/20-studio-api/20-deploy-read-change-and-delete.md#when-another-template-is-primary-at-the-url | use-compositions-api |
422 | 71 | This template can't be deployed as a secondary template: … | The “URL serving mode” field couldn't be added. Nothing changed. | provision-studio-project |
500 | 36 | Failed to compress the composition UI spec | The API couldn't compress ui and read it back unchanged, so it saved nothing. | use-compositions-api / author-composition-via-api |
The status Contentstack returned, or 502 | 38 | Contentstack rejected the composition: … | Contentstack refused a composition read or write. A 401, 403, 409, 422 or 429 from Contentstack keeps its status. A server error or no answer becomes 502. | use-compositions-api / author-composition-via-api |
The status the component service returned, or 502 | 46 | The component service rejected the request: … | The registered components service refused the call. A 403 or other client error keeps its status. | use-compositions-api / author-composition-via-api |
502 | 46 | The component service could not be reached (…). | The registered components service didn't answer, or answered with something other than a list. | use-compositions-api / author-composition-via-api |
For 32, the errors object lists every layout rule the write broke. The rules and their messages are on the API errors and validation page, under "Layout rules the API checks on every write".
Acceptance
- The code was matched to exactly one row, and the answer names its class and whether the site should return a 404 or a 5xx.
- The specialist named in the row was Read before any deeper diagnosis.
- A code not in these tables is reported as unknown, with the full log line, and the user is pointed to the error message index. No cause is invented.
See also
troubleshoot: the symptom router, for problems with no code.troubleshoot-error-messages: exact messages that carry no code.