Skip to main content

Error Handling

All NexSpace API errors return a consistent JSON structure with machine-readable codes and agent-friendly recovery hints.

Error Format

Common Error Codes

When retryable is omitted, infer it from the status: 429, 503, 408, 502, and 504 are retryable; other 4xx are not.

Errors over MCP

Tool calls to the MCP server return errors two ways:
  • Protocol errors (unknown tool, bad params, insufficient scope) come back as a JSON-RPC error object. The error.data carries suggestion and retryable, mirroring the REST contract.
  • Execution failures (the tool ran but failed) come back as a normal tools/call result with isError: true. The content[].text payload includes the failure message followed by a Suggestion: line so the calling model can self-correct.

Best Practices

  1. Check retryable — if true, retry with exponential backoff; if false, reformulate the request instead of retrying
  2. Read suggestion — it tells agents exactly how to fix the issue
  3. Log requestId — include it when contacting support
  4. Handle code programmatically — don’t parse message strings