Errors

API and CDN error codes and handling.

Tuzzle uses standard HTTP status codes with JSON error responses.

API Error Format

{
  "message": "The given data was invalid.",
  "errors": {
    "name": ["The name field is required."],
    "space": ["The space field is required."]
  }
}

For single errors:

{
  "message": "Unauthenticated."
}

CDN Error Format

{
  "error": {
    "code": 422,
    "message": "Invalid modifiers",
    "type": "ValidationError",
    "details": { ... }
  },
  "request_id": "abc123..."
}

HTTP Status Codes

Success Codes

CodeDescription
200OK. Request succeeded.
201Created. Resource created successfully.
204No Content. Request succeeded with no response body.

Client Error Codes

CodeDescription
400Bad Request. Malformed request or path traversal attempt.
401Unauthenticated. Missing or invalid API key.
403Forbidden. Valid auth but insufficient permissions, or invalid signed URL.
404Not Found. Resource does not exist.
413Payload Too Large. File exceeds the maximum size limit.
422Unprocessable Entity. Validation failed (invalid params, format, etc.).
429Too Many Requests. Rate limit exceeded. Check Retry-After header.

Server Error Codes

CodeDescription
500Internal Server Error. Something went wrong on the server.
503Service Unavailable. Server under memory pressure or processing queue full.

Common API Errors

Authentication

ErrorCauseFix
"Unauthenticated."Missing or invalid API keyCheck your API key is correct and active
"Forbidden."Key does not have access to this resourceVerify the key is scoped to the correct space

Validation

ErrorCauseFix
"The name has already been taken."Duplicate space nameChoose a unique name
"The file field is required."Missing file in uploadInclude file or files field

Upload

ErrorCauseFix
"File type not allowed."Blocked extension or format not in whitelistCheck upload config's allowed_formats
"File too large."Exceeds max_file_sizeReduce file size or increase config limit
"Security validation failed."Dangerous file extension detectedUpload a safe file type

CDN Transformation

ErrorCauseFix
"Invalid modifiers"Bad query parameter valuesCheck parameter format and ranges
"Crop mode requires both width and height"Missing w or h with r=cropProvide both dimensions
"Format dimension limit exceeded"WebP/AVIF with >2000px dimensionUse a smaller size or different format

CDN Response Headers

Validation results are also returned in response headers:

HeaderContentWhen
x-tzzl-errorsJSON array of errorsOn 422 responses
x-tzzl-warningsJSON array of warningsOn successful responses with caveats

Retry Strategy

For 429 and 503 responses:

  1. Read the Retry-After header for the wait time
  2. Wait the specified duration
  3. Retry the request
  4. Use exponential backoff if no Retry-After header is present

For 5xx responses (other than 503):

  1. Wait 1-2 seconds
  2. Retry up to 3 times with exponential backoff
  3. If still failing, check the API status