Skip to docs content

Error and warning codes

SCPM emits stable string identifiers with errors and most warnings. Codes look like ERR_SCPM_NO_LOCKFILE or WARN_SCPM_IGNORED_BUILD_SCRIPTS, and they are attached as structured fields so scripts do not need to regex human-readable stderr.

How to read codes

Text output includes codes in the rendered diagnostic. ndjson output carries a code field on each record:

{
  "level": "WARN",
  "code": "WARN_SCPM_IGNORED_BUILD_SCRIPTS",
  "count": 2,
  "packages": ["esbuild", "opencode-ai"],
  "message": "ignored build scripts for 2 package(s)"
}

Naming

  • ERR_SCPM_* codes are fatal and exit non-zero.
  • WARN_SCPM_* codes are non-fatal warnings.

SCPM reserves its own code prefix even when a diagnostic maps onto a pnpm concept such as lockfiles, peer dependencies, or tarball integrity.

Registry source

The generated code registry lives in the CLI source:

  • cli/crates/scpm-codes/src/errors.rs
  • cli/crates/scpm-codes/src/warnings.rs
  • cli/crates/scpm-codes/src/exit.rs

Run the upstream generator from cli/ after adding or changing codes.