Protobox

Error Reference

Error codes, response formats, and troubleshooting for the Protobox CLI and SDK

Every error from the Protobox API follows a consistent format. This page documents the error codes, how they surface in the CLI and SDK, and how to fix the common ones.

Error Response Format

When an API request fails, the response body has this shape:

{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "Tool with ID 695d6957e21c0ceb325c394d not found",
    "details": null
  },
  "timestamp": "2026-03-21T14:30:00.000Z"
}
FieldWhat it tells you
error.codeMachine-readable error type — branch on this in code
error.messageHuman-readable explanation, often with the resource type and ID
error.detailsExtra context — field-level validation errors, billing limits, dependencies

Error Codes

HTTPCodeCommon CauseFix
400VALIDATION_ERRORMissing field, wrong type, malformed JSONCheck field types and required fields against the API docs
401AUTHENTICATION_ERRORExpired or missing API key, invalid JWTRe-authenticate with protobox login, or set a key with protobox config set apiKey <key>
402BILLING_LIMIT_EXCEEDEDWorkspace hit a tier limit or usage quotaUpgrade your plan or wait for the period to reset
403AUTHORIZATION_ERRORWrong workspace, insufficient roleVerify with protobox auth status and check your role
404NOT_FOUNDResource deleted, wrong ID, or in another workspaceVerify the ID with protobox <resource> list
409CONFLICT_ERRORDuplicate name, or active dependenciesRename, or remove dependents first
429RATE_LIMIT_ERRORToo many requests in a short windowWait and retry — the SDK backs off automatically
5xxSERVER_ERRORServer-side or transient infrastructure issueRetry once; if it persists, report it with the requestId

Validation Error Details

Validation errors can include field-level information:

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed",
    "details": {
      "fieldErrors": {
        "name": ["name must be a string", "name should not be empty"],
        "type": ["type must be one of: http, javascript, code"]
      }
    }
  }
}

CLI Error Format

The CLI translates API errors into colored terminal output:

✗ Error: Tool with ID 695d6957e21c0ceb325c394d not found
  Code: NOT_FOUND (404)

With --json, errors are returned as structured JSON and the exit code is non-zero — so set -e and if checks work in scripts.

protobox tools get 695d6957e21c0ceb325c394d --json

SDK Error Handling

Every SDK error extends the base ChanlError class. (The product is Protobox; this internal class name is retained from the shared SDK lineage.)

Basic try/catch

import { ProtoboxSDK, ChanlError, NotFoundError, ValidationError } from '@protoboxai/sdk';

const client = new ProtoboxSDK({
  baseUrl: 'https://platform.protobox.ai',
  apiKey: process.env.PROTOBOX_API_KEY,
});

try {
  await client.tools.get('nonexistent-id');
} catch (error) {
  if (error instanceof NotFoundError) {
    console.log(error.resourceType, error.resourceId);
  } else if (error instanceof ValidationError) {
    console.log(error.fieldErrors);
    console.log(error.getFieldErrors('name'));
    console.log(error.hasFieldError('name'));
  } else if (error instanceof ChanlError) {
    console.log(error.code, error.statusCode, error.message, error.requestId);
  }
}

Error Class Hierarchy

ChanlError (base)
├── NotFoundError          404  NOT_FOUND
├── ValidationError        400  VALIDATION_ERROR
├── AuthenticationError    401  AUTHENTICATION_ERROR
├── AuthorizationError     403  AUTHORIZATION_ERROR
├── ConflictError          409  CONFLICT_ERROR
├── RateLimitError         429  RATE_LIMIT_ERROR
├── ServerError            5xx  SERVER_ERROR
├── NetworkError           ---  NETWORK_ERROR
└── TimeoutError           ---  TIMEOUT_ERROR

Type Guards

import {
  isChanlError,
  isNotFoundError,
  isValidationError,
  isAuthenticationError,
} from '@protoboxai/sdk';

try {
  await client.tools.execute(toolId, { order_id: 'ORDER-12345' });
} catch (error) {
  if (isNotFoundError(error)) {
    console.log(`${error.resourceType} ${error.resourceId} not found`);
  } else if (isAuthenticationError(error)) {
    client.updateAuth({ apiKey: getNewApiKey() });
  } else if (isChanlError(error)) {
    console.error(`[${error.code}] ${error.message}`);
  }
}

Serialization

Every ChanlError is JSON-serializable for logging:

try {
  await client.tools.create({ name: '' } as never);
} catch (error) {
  if (isChanlError(error)) {
    logger.error(error.toJSON());
  }
}

Retry Configuration

The SDK retries failed requests automatically. By default:

  • Max retries: 3
  • Initial delay: 1000ms
  • Backoff multiplier: 2x (1s, 2s, 4s)

Only retryable failures retry — network errors, timeouts, and 429/5xx. Client errors (400, 401, 403, 404, 409) never retry.

const client = new ProtoboxSDK({
  baseUrl: 'https://platform.protobox.ai',
  apiKey: process.env.PROTOBOX_API_KEY,
  retry: { maxRetries: 5, retryDelay: 500, backoffMultiplier: 3 },
});

// Disable retries
const noRetry = new ProtoboxSDK({
  baseUrl: 'https://platform.protobox.ai',
  apiKey: process.env.PROTOBOX_API_KEY,
  retry: { maxRetries: 0, retryDelay: 0, backoffMultiplier: 1 },
});

Common Scenarios

Getting Help

If you hit an error that isn't listed here:

  1. Capture the request IDerror.requestId in the SDK, or --json output from the CLI.
  2. Check API status with protobox health.
  3. Include the error code, message, and request ID when you reach out.

On this page