API referenceInstance API
GUIDE & REFERENCE

Errors and request limits

The daemon error envelope, status mapping, service availability, and source-defined request limits.

Error envelope

Handlers using DaemonError return a JSON object with code and message:

{
  "code": "error",
  "message": "invalid id"
}

The example shows the envelope, not a universal message. Do not rely on the text of a message as a stable machine-readable error identifier.

Source variantHTTP statuscode
InvalidRequest400error
Unauthorized401error
Forbidden403error
NotFound404error
PayloadTooLarge413working_memory_value_too_large
Overloaded429cognitive_runtime_capacity_exceeded
WorkingMemoryCapacity429working_memory_capacity_exceeded
Internal500error
DataCorruption500data_corruption
ServiceDisabled503error
Timeout504error

The rate-limit middleware has its own 429 envelope: {"code":"rate_limited","message":"too many requests"}. Axum JSON/path/query extraction failures, unknown routes, unsupported methods, and raw responses can use different bodies. The generated operation reference lists error variants explicitly referenced by each handler; downstream calls can add further errors.

Service availability

There are two gates. At startup, the router conditionally registers most feature families from ServiceConfig. At request time, a service-prefix middleware checks whether the corresponding service is currently enabled. A missing registration can produce 404; an available route whose service or dependency is disabled can return 503.

Health routes ending in /health or /health/startup bypass the runtime service middleware, but their handlers may still report a missing dependency. Working-memory and cognitive-control routes have additional handler-level availability and authority checks. Model-manager routes are registered even when manager initialization failed; those requests return a service-disabled error.

Request size and rate limits

SettingSource defaultScope
AKASHA_REQ_MAX_BYTES10,000,000 bytesAxum default body limit; individual operations can enforce smaller limits.
AKASHA_RATE_LIMIT_RPS1,000A direct rate limiter shared by the instance state, not a separate quota per API key.
Cognitive-cycle input1,000,000 bytesHandler-defined serialized input limit.
Cognitive trigger256 bytesHandler-defined trigger limit.
MIND embedding dimensionality65,536Receiver schema bound; vector components must be finite and the declared dimension must match the vector length.

These are configuration/default facts, not throughput benchmarks. A lifecycle soft ceiling can also pause work and return 429; the current source routes that condition through Overloaded.

Recovery and retries

The reference does not claim a global idempotency-key contract. A retry of a mutation can have effects unless the specific handler implements duplicate detection or idempotent behavior. Read the operation’s validation and mutation sequence before adding automatic retries. A generic 500, 503, or connection failure does not establish that a write was never applied.

Source: akasha-daemon/src/main.rs (DaemonError::into_response, rate_limit_layer, runtime_service_middleware, Cli, and cognitive-cycle constants); akasha-daemon/src/mind_receiver.rs.

On this page