Skip to content

Error document schema

The error document takes the place of the report when witnyx check cannot run: in each file that --output json=PATH names, and on standard output in agent mode. init prints it in agent mode when it cannot run, and upload when its arguments cannot be parsed or it fails before it starts. Arguments that cannot be parsed give it too. The exit code is then 2.

Two things are not such errors. An upload that the service did not record is reported in the upload document. An incomplete check with --strict writes the normal report, with result.exitCode 2.

error.code is one of the error codes, error.message and error.hint say what happened and what to do, and error.retryable says whether running the same command again unchanged may succeed. Error codes shows a document.

Its ID is https://witnyx.dev/schemas/error/v1.json, and every error document names it in its schema field. witnyx schema error prints the copy bundled with the tool:

Terminal window
$ witnyx schema error
"$id": "https://witnyx.dev/schemas/error/v1.json",
"title": "Witnyx error document, version 1",
error-v1.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://witnyx.dev/schemas/error/v1.json",
"title": "Witnyx error document, version 1",
"description": "Written instead of a report when `witnyx check` cannot run, and by `witnyx init` and `witnyx upload` in agent mode when they cannot run (exit code 2): to every --output json target, and on standard output in agent mode (spec sections 10.3 and 12.2). Arguments that cannot be parsed give this document too. For upload, that and an internal error before it starts are the only cases: an upload that was not recorded is reported in the upload document (upload/v1.json). An incomplete run under --strict is not such an error: it writes the normal report, with result.exitCode 2. Offline runs are always incomplete, so --offline --strict never exits 0.",
"type": "object",
"additionalProperties": false,
"required": ["schema", "error"],
"properties": {
"schema": { "const": "https://witnyx.dev/schemas/error/v1.json" },
"error": {
"type": "object",
"additionalProperties": false,
"required": ["code", "message", "retryable"],
"properties": {
"code": {
"enum": ["WX-SBOM-NOT-FOUND", "WX-SBOM-AMBIGUOUS", "WX-SBOM-PARSE", "WX-SBOM-UNSUPPORTED", "WX-SBOM-EMPTY",
"WX-CONFIG", "WX-NET-KEV", "WX-NET-EUVD", "WX-NET-EOL", "WX-TIMEOUT", "WX-UPLOAD",
"WX-INTERNAL"]
},
"message": { "type": "string", "minLength": 1 },
"hint": { "description": "What to do about it.", "type": "string" },
"retryable": { "description": "Whether running again unchanged may succeed.", "type": "boolean" }
}
}
}
}

Witnyx is a record-keeping and workflow tool. It does not certify compliance. Nothing on this site is legal advice.