{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/mmerterden/multi-agent-pipeline/pipeline/schemas/contract-error.schema.json",
  "title": "Contract error",
  "description": "Every non-2xx body contract-server.mjs sends, on the desktop and the phone routes alike. `error` is a fixed code a client switches on; `message` is for a person and names no path, host or token. `errors` lists schema or rule violations for invalid-body and invalid-request; `supported` lists the majors ?v= accepts for unsupported-version. run-active and not-resumable answer POST /v1/runs/{id}/resume; confirm-expired and confirm-mismatch answer the confirming request of a kill or gc.",
  "type": "object",
  "additionalProperties": false,
  "required": ["contractVersion", "error", "message"],
  "properties": {
    "contractVersion": {
      "type": "string",
      "pattern": "^1\\.[0-9]+\\.[0-9]+$",
      "x-sensitivity": "none"
    },
    "error": {
      "enum": [
        "unauthorized",
        "forbidden-host",
        "forbidden-origin",
        "not-found",
        "method-not-allowed",
        "invalid-query",
        "unsupported-version",
        "unsupported-media-type",
        "invalid-body",
        "invalid-request",
        "no-launch-shape",
        "not-waiting",
        "wrong-question",
        "wrong-arity",
        "not-an-option",
        "state-moved",
        "unsigned",
        "unknown-device",
        "revoked-device",
        "bad-signature",
        "stale-request",
        "replayed",
        "replay-store-full",
        "unknown-verb",
        "forbidden-scope",
        "launch-disabled",
        "repo-not-allowed",
        "run-active",
        "not-resumable",
        "confirm-expired",
        "confirm-mismatch",
        "unattended-profile-missing",
        "workspace-not-trusted",
        "internal"
      ],
      "x-sensitivity": "none"
    },
    "message": { "type": "string", "x-sensitivity": "none" },
    "errors": { "type": "array", "items": { "type": "string" }, "x-sensitivity": "none" },
    "supported": { "type": "array", "items": { "type": "integer" }, "x-sensitivity": "none" },
    "remedy": {
      "type": "string",
      "x-sensitivity": "none",
      "description": "What fixes the refusal: for unattended-profile-missing the installer step that writes the unattended permission profile; for workspace-not-trusted opening Claude Code once in the repository to accept the trust prompt (the path is left out under redact)."
    }
  }
}
