{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/contract-error.schema.json",
  "title": "Contract error",
  "description": "Every non-2xx body contract-server.mjs sends. `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": "^[0-9]+\\.[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",
        "launch-disabled",
        "repo-not-allowed",
        "run-active",
        "not-resumable",
        "confirm-expired",
        "confirm-mismatch",
        "unattended-profile-missing",
        "workspace-not-trusted",
        "no-selection",
        "repo-not-configured",
        "invalid-config",
        "not-installed",
        "repo-ambiguous",
        "unreadable-settings",
        "not-removable",
        "not-steerable",
        "too-many-streams",
        "no-review",
        "upstream-failed",
        "tool-not-allowed",
        "busy",
        "review-incomplete",
        "host-not-allowed",
        "internal",
        "unknown-job",
        "command-not-installed",
        "invalid-repo",
        "invalid-args",
        "room-busy",
        "sandbox-unavailable",
        "launch-failed",
        "guard-missing",
        "name-taken",
        "already-registered",
        "not-registered",
        "unattended-refused",
        "not-applied",
        "changed"
      ],
      "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)."
    }
  }
}
