Open Studio
Reference

Diagnostics

Reference for Kubb's diagnostic codes, the stable codes Kubb prints when a build fails, with causes and fixes.

When a build fails, Kubb prints a diagnostic with a stable code, the message, the location in your document, and a suggested fix. The CLI leads with the code and lists the details below it:

Terminal
text
[KUBB_REF_NOT_FOUND]: Could not find a definition for #/components/schemas/Pet.
  at: #/components/schemas/Pet
  fix: Add the schema under components.schemas, or fix the $ref.
  see: https://kubb.dev/docs/5.x/reference/diagnostics/kubb-ref-not-found

Severity ​

The severity tints the [CODE] tag.

SeverityColorEffect
errorredFails the run with a non-zero exit code.
warningyellowReported, does not fail the run.
infoblueAdvisory, does not fail the run.

Input ​

CodeSeveritySummary
KUBB_INPUT_NOT_FOUNDerrorThe file set as input could not be read.
KUBB_INPUT_REQUEST_FAILEDerrorA URL set as input answered with a 4xx or 5xx status.
KUBB_INPUT_UNREACHABLEerrorA URL set as input never answered.
KUBB_INPUT_REQUIREDerrorAn adapter was configured without an input.
KUBB_LEGACY_INPUTerrorinput uses the v4 { path } / { data } wrapper.

Configuration ​

CodeSeveritySummary
KUBB_PLUGIN_NOT_FOUNDerrorA required plugin is missing from the config.
KUBB_ADAPTER_REQUIREDerrorAn action needs an adapter but none is configured.
KUBB_PATH_TRAVERSALerrorA resolved path escaped the output directory.
KUBB_CLEAN_ROOTerroroutput.clean would delete the project root instead of only the generated code.
KUBB_INVALID_PLUGIN_OPTIONSerrorA plugin was configured with options that cannot be honored.

OpenAPI ​

CodeSeveritySummary
KUBB_INVALID_DOCUMENTerrorThe resolved input declares no openapi or swagger version.
KUBB_REF_NOT_FOUNDerrorA $ref could not be resolved in the document.
KUBB_INVALID_SERVER_VARIABLEerrorA server variable value is not allowed by its enum.
KUBB_UNSUPPORTED_FORMATwarningA schema format has no specific type mapping, so it falls back to the base type.
KUBB_DEPRECATEDinfoA referenced schema or operation is marked deprecated.

Plugins ​

These carry whatever a plugin reports through its generator context (ctx.error, ctx.warn, ctx.info), attributed to the plugin that reported it.

CodeSeveritySummary
KUBB_PLUGIN_FAILEDerrorA plugin threw while generating, or reported an error.
KUBB_PLUGIN_WARNINGwarningA plugin reported a non-fatal warning.
KUBB_PLUGIN_INFOinfoA plugin reported an informational message.
KUBB_BARREL_DUPLICATE_EXPORTerrorTwo files in the same barrel directory export the same name.

Output pipeline ​

The formatter, linter, and post-generate hooks run after generation. A failure in any of them becomes a diagnostic that fails the run.

CodeSeveritySummary
KUBB_FORMAT_FAILEDerrorThe formatter pass over the generated files failed.
KUBB_LINT_FAILEDerrorThe linter pass over the generated files failed.
KUBB_POST_GENERATE_FAILEDerrorA post-generate output.postGenerate command exited non-zero.

Other ​

CodeSeveritySummary
KUBB_UNKNOWNerrorAn error without a specific code.

Bookkeeping ​

These are not problems. They carry run metadata, never fail the build, and feed the CLI's summary and notices rather than the diagnostic log.

CodeSeveritySummary
KUBB_PERFORMANCEinfoA plugin's elapsed time. The run total is the sum of these.
KUBB_UPDATE_AVAILABLEinfoA newer Kubb version is available on npm.

Machine-readable output ​

kubb generate --reporter json prints a stable report to stdout. The output is a JSON array with one report per config, so a single-config run still prints [ ... ]. CI can read diagnostics without scraping the terminal:

Report
json
[
  {
    "name": "",
    "status": "failed",
    "plugins": { "passed": 2, "failed": ["plugin-zod"], "total": 3 },
    "counts": { "errors": 1, "warnings": 0, "infos": 0 },
    "filesCreated": 0,
    "durationMs": 312,
    "output": "/project/src/gen",
    "timings": [{ "plugin": "plugin-ts", "durationMs": 84 }],
    "diagnostics": [
      {
        "code": "KUBB_REF_NOT_FOUND",
        "severity": "error",
        "message": "Could not find a definition for #/components/schemas/Pet.",
        "location": { "kind": "schema", "pointer": "#/components/schemas/Pet" },
        "help": "Add the schema under components.schemas, or fix the $ref. Run `kubb validate` to check the spec.",
        "docsUrl": "https://kubb.dev/docs/5.x/reference/diagnostics/kubb-ref-not-found"
      }
    ]
  }
]

Each config emits one report. counts totals the problem diagnostics by severity. timings lists per-plugin durations slowest first. name is the config name, empty when unnamed.

The exit code is unchanged: non-zero on any error. See --reporter for the other reporters.