{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.ironscout.ai/ids/schemas/error_v1.schema.json",
  "title": "error_v1",
  "description": "IDS v1 schema for error responses (HTTP 4xx/5xx) returned from IDS-governed endpoints. See https://www.ironscout.ai/.well-known/ids.md §9.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "errorCode", "message"],
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "error_v1"
    },
    "requestId": {
      "type": ["string", "null"],
      "description": "Opaque per-request identifier for correlating server logs. May be null when the error occurred before request context was established."
    },
    "errorCode": {
      "type": "string",
      "pattern": "^[A-Z][A-Z0-9_]*$",
      "description": "Stable, machine-readable identifier for the error class. Consumers MAY branch on this value. Suggested values: NOT_FOUND, INVALID_QUERY, AMBIGUOUS_STATE, RATE_LIMITED, INTERNAL_ERROR."
    },
    "message": {
      "type": "string",
      "description": "Human-readable error description. MUST NOT leak secrets, stack traces, or sensitive internal state."
    },
    "details": {
      "description": "Optional non-sensitive error details. Free-form; consumers SHOULD NOT depend on a specific shape. Servers MUST NOT include credentials, internal identifiers (e.g. unhashed sourceId), or stack traces here."
    }
  }
}
