Error Handling

The plugin provides structured error codes for every failure scenario with automatic retry logic for transient errors.

Error Codes

All errors are returned as AxiomClientError objects with a machine-readable code field. Tool outputs prefix the error message with [ERROR_CODE].

CodeHTTP StatusDescriptionResolution
MISSING_WORKER_URLWorker URL is not configuredSet workerUrl in plugin config
MISSING_API_KEYAPI key is not configuredSet OPENROUTER_API_KEY env or apiKey in config
EMPTY_QUERYQuery string is empty or whitespaceProvide a non-empty query
INSUFFICIENT_MODELSFewer than 2 models specifiedAdd more models to the request or defaultModels config
AUTH_FAILED401 / 403API key is invalid or expiredCheck your OpenRouter API key
RATE_LIMITED429Too many requestsWait and try again later
CLIENT_ERROR400–499Client-side request errorCheck request parameters
SERVER_ERROR500+Worker encountered an errorCheck worker logs; will auto-retry
RETRY_EXHAUSTEDAll retry attempts failedCheck network connectivity and worker health

Retry Logic

The client automatically retries failed requests with the following behavior:

  • Max retries: 2 (total of 3 attempts)
  • Retry delay: 1,000ms+ between attempts
  • Retried errors: 5xx server errors, network failures
  • Not retried: 401/403 auth errors, 400-499 client errors

Auth errors are never retried

If you receive an AUTH_FAILED error, the plugin will not retry. This prevents burning API quota with an invalid key. Fix the key and try again.

Timeout

Each consensus request has a configurable timeout (default: 120 seconds). The timeout is implemented via AbortController for clean cancellation.

  • Consensus with 7 iterations and 3 models typically takes 15\u201345 seconds
  • The first request may be slower due to model initialization (cold start)
  • If you consistently hit timeouts, consider reducing maxIterations or using fewer models

Input Validation

The plugin validates inputs before sending requests:

  • Empty query — the query string is trimmed and checked. Empty or whitespace-only queries are rejected with EMPTY_QUERY
  • Insufficient models — at least 2 models are required for consensus. If fewer are provided (and no defaults are configured), the error INSUFFICIENT_MODELS is raised
  • Missing configurationworkerUrl and apiKey are validated at client construction time

Network Errors

If the worker endpoint is unreachable, the plugin reports a connection error with the target URL. Common causes:

  • Worker is not deployed or is down
  • Incorrect workerUrl in configuration
  • DNS resolution failure
  • Firewall or proxy blocking the connection

Health check

The client provides a healthCheck() method that sends a GET request to /health on the worker. Use it to verify connectivity before running consensus queries.

Quick Troubleshooting

SymptomLikely CauseFix
"Invalid API key"Wrong or expired OpenRouter keyRegenerate key at openrouter.ai
"Rate limited"Too many requests to OpenRouterWait 60s or upgrade your plan
Timeout after 120sToo many models or iterationsReduce maxIterations to 3–5 or use fewer models
"Connection error"Worker endpoint unreachableVerify workerUrl and check worker deployment
Low confidence resultsInsufficient iterations or threshold too lowIncrease maxIterations or lower dThreshold