{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "--json: error",
  "description": "The one object a command prints on stdout under --json when it fails. The process exit code equals exit_code (see the exit-code table: a deployment that did not go live is 1, a project that does not exist is 4).",
  "type": "object",
  "required": [
    "error",
    "exit_code"
  ],
  "properties": {
    "error": {
      "type": "string",
      "minLength": 1,
      "description": "What went wrong, written so the code or the command can be fixed."
    },
    "exit_code": {
      "type": "integer",
      "minimum": 1,
      "description": "The exit code of the process."
    },
    "reason": {
      "type": "string",
      "pattern": "^[A-Z][A-Z0-9_]*$",
      "description": "Stable machine-readable code, present when the platform classified the failure. A deployment that did not go live carries the code of its cause (the same one diagnose --json reports); every code is explained at /docs/errors."
    },
    "next": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The commands that move forward, in order; present when one is known."
    },
    "upgrade_url": {
      "type": "string",
      "pattern": "^https?://",
      "description": "Present only when reason is PLAN_UPGRADE_REQUIRED."
    },
    "refusal": {
      "type": "object",
      "required": ["kind"],
      "properties": {
        "kind": { "type": "string", "description": "The addon the platform refused." },
        "plan": { "type": "string", "description": "The plan that has it, when the refusal is a plan." },
        "url": { "type": "string", "description": "Where the plan is changed." }
      },
      "description": "Present when a deploy stopped because a [[addon]] table in the repository's configuration was refused (exit 5). Nothing was created and the build did not start."
    }
  }
}
