Skip to main content
GraphQL errors follow the standard GraphQL error format with additional extensions for error codes.

Error Format

Common Error Codes

Preview-Specific Error Codes

Error Examples

Resource Not Found

content, component, and tag return null without an error when the ID doesn’t exist:

Unauthorized

Invalid Preview Token

Version Not Found

Validation Error

Client-Side Error Handling

JavaScript

Apollo Client

React Hook

Subscription Error Handling

Best Practices

  1. Always check for errors: GraphQL can return partial data with errors
  2. Use error codes: Check extensions.code for programmatic error handling
  3. Handle null results: content, component, and tag return null when a resource is deleted, unpublished, or doesn’t exist
  4. Implement retry logic: Network errors may be transient
  5. Log errors: Include path and extensions for debugging
  6. Differentiate preview errors: Preview links stop working when they are deleted; handle PREVIEW_NOT_FOUND separately from API key errors