AION
/Substrate Codex
Computational APIsEpistemic & System Error Taxonomy

Error Codes & Epistemic Failures

Unlike standard SaaS APIs that only report database or network errors, AION reports Epistemic Errors—explicitly halting computation whenever a query asks the system to speculate, fabricate evidence, or violate the 15 Constitutional Laws.

Canonical Error Envelope

All 4xx and 5xx responses return a structured JSON envelope with machine-readable codes and remediation advice:

{
  "error": {
    "code": "E_UNVERIFIED_POPULATION_CLAIM",
    "httpStatus": 422,
    "message": "Population generalization rejected: media discourse cannot be attributed to national population sentiment without NBS census data.",
    "constitutionalLaw": "Law 5: Population claims require population evidence.",
    "remediation": "Narrow query scope to reported media discourse or specify an explicit dataset domain."
  }
}

Epistemic & System Error Reference

Error CodeHTTP StatusOriginDescription
E_INSUFFICIENT_EVIDENCE422 Unprocessable EntityLaw 1 & 7Triggered when a query demands definitive claims but the substrate possesses insufficient primary evidence. AION refuses to hallucinate.
E_UNVERIFIED_POPULATION_CLAIM422 Unprocessable EntityLaw 5Triggered when a prompt asks for population-level assertions ('What do all Nigerians think?') without NBS demographic survey proof.
E_TEMPORAL_OUT_OF_BOUNDS400 Bad RequestLaw 2Requested start date precedes substrate historical baseline (2015-01-01) or requests predictive future speculation.
E_EVIDENCE_NOT_FOUND404 Not FoundLaw 3The requested evidence record or cryptographic SHA-256 snapshot does not exist in local records or Cloudflare R2 / S3 storage.
E_RATE_LIMIT_EXCEEDED429 Too Many RequestsInfrastructureYour API key exceeded its tier limit. Respect the Retry-After header and implement exponential backoff.
E_UNAUTHORIZED_KEY401 UnauthorizedSecurityMissing, expired, or malformed X-AION-Key header.

Retry Logic & Exponential Backoff

For 429 Too Many Requests and 503 Service Unavailable, inspect the Retry-After header (in seconds). Implement exponential jitter backoff:waitMs = min(30000, (2 ** attempt) * 1000 + random(0, 1000))

Benchmark Suite
The 20 Golden Longitudinal Questions
View Golden Benchmarks →