{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://atlas.local/schemas/error.schema.json",
  "title": "Atlas error record",
  "type": "object",
  "required": [
    "provider",
    "http_status",
    "type"
  ],
  "properties": {
    "provider": {
      "enum": [
        "openai",
        "anthropic",
        "xai",
        "gemini"
      ]
    },
    "http_status": {
      "type": [
        "integer",
        "string",
        "null"
      ]
    },
    "type": {
      "type": [
        "string",
        "null"
      ],
      "description": "provider error.type (e.g. rate_limit_error)"
    },
    "code": {
      "type": [
        "string",
        "null"
      ],
      "description": "provider error.code where applicable"
    },
    "message_semantics": {
      "type": [
        "string",
        "null"
      ]
    },
    "retryable": {
      "type": [
        "boolean",
        "string",
        "null"
      ]
    },
    "recommended_action": {
      "type": [
        "string",
        "null"
      ]
    },
    "backoff": {
      "type": [
        "string",
        "null"
      ]
    },
    "category": {
      "type": [
        "string",
        "null"
      ],
      "description": "rate_limit | authentication | invalid_request | content_safety | capacity | overload | timeout | server_error | not_found | permission | quota"
    },
    "observed_live": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "example": {},
    "source": {
      "type": [
        "string",
        "object",
        "array",
        "null"
      ]
    }
  }
}
