{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sigelo-io/json-schema/sigelo-io-error-schema.json",
  "title": "Error",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sigelo-io-openapi.yaml#/components/schemas/Error",
  "type": "object",
  "required": [
    "error",
    "code"
  ],
  "properties": {
    "error": {
      "type": "string",
      "description": "The failing check in prose. Safe to show; never parse it — use `code`."
    },
    "code": {
      "type": "string",
      "description": "The check that refused: the reason's prefix before `:` (apps/keeper/service.ts `codeOf`),\nexcept an allowlist refusal that is really a spent or expired invoice (`invoice`) and\nthe wallet's two kinds of \"not enough\" (`wallet_locked`, `wallet_funds`) and a wallet\nwith no connection to its daemon (`wallet_offline`), and a build that ran out the\nkeeper's build wait (`wallet_slow`). Values the\ncode produces: token, bucket, request, purpose, ref, to, to.addr, to.did, allowlist,\ninvoice, amount, per_tx_max, per_period_max, rate_per_minute, repeat, approval,\nrelay_failed, wallet, wallet_locked, wallet_funds, wallet_offline, wallet_slow, log, body, route, bind, delegate,\nfund, revoke, dry_run, paused (403: the Owner paused this agent), owner (403: a refused\nPOST /policy or /agents), licence_required (403: a paid verb on a keeper without a valid\nlicence), clock_behind (503), busy (503: the lane is full), origin (403: a foreign\nHost or an Origin header), internal (the catch-all 500), service (a\nreason with no prefix). Not closed: new checks add values.\n"
    },
    "facts": {
      "$ref": "#/$defs/Facts"
    }
  },
  "$defs": {
    "Atomic": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)$",
      "description": "Atomic units as a decimal string (1 XMR = 10^12). Never a JSON number."
    },
    "Facts": {
      "type": "object",
      "description": "The numbers behind a cap refusal (per_tx_max, per_period_max), so a client can say it without parsing `error`.",
      "required": [
        "cost",
        "limit",
        "fee_included"
      ],
      "properties": {
        "cost": {
          "$ref": "#/$defs/Atomic"
        },
        "limit": {
          "$ref": "#/$defs/Atomic"
        },
        "fee_included": {
          "type": "boolean",
          "description": "true when the check ran on amount + fee (after the wallet priced it)."
        },
        "left": {
          "$ref": "#/$defs/Atomic"
        },
        "until": {
          "$ref": "../../schema/common.json#/$defs/unixSeconds",
          "description": "When the oldest debit in the window rolls out."
        },
        "amount": {
          "$ref": "#/$defs/Atomic",
          "description": "After pricing only. The payment alone; at most `limit` on a per_tx_max refusal means the fee pushed it over."
        },
        "fee": {
          "$ref": "#/$defs/Atomic",
          "description": "After pricing only. The fee the wallet priced."
        },
        "inputs": {
          "type": "integer",
          "minimum": 1,
          "description": "After pricing",
          "when wallet-rpc's reply lists spent_key_images. The inputs the transaction spends.": null
        }
      }
    }
  }
}