Skip to main content

MEP-57 error code registry

Every error returned by cmd/mochi/pkg* or pkg/pkg* packages must be sourced from a sentinel listed here. Phase docs link to a row rather than redeclaring a local table, so errors.Is(err, pkgerr.LockE001) works across phase boundaries.

Conventions:

  • All codes are namespaced M057_<CATEGORY>_E<NNN>.
  • Phase docs introduce sentinels under pkg/pkgerr/; each sentinel is exported as ErrCATEGORYExxx.
  • Codes are dense within a category (E001, E002, ... no gaps).
  • A code is owned by exactly one phase. Other phases wrap with %w rather than re-declaring.
  • User-facing rows include a recovery hint. Internal markers (cold-cache, retry-from-sentinel) are tagged internal.

MANIFEST (Phase 1)

CodeOwnerTriggerRecovery hint
M057_MANIFEST_E0011.1TOML lex/parse failure"fix the syntax at line N"
M057_MANIFEST_E0021.2Unknown top-level key"remove or rename <key>"
M057_MANIFEST_E0031.2Missing required [package] field"add <field> to [package]"
M057_MANIFEST_E0041.2Invalid version range syntax"see semver caret/tilde docs"
M057_MANIFEST_E0051.2Invalid SPDX 3.x license expression"use a valid SPDX expression"
M057_MANIFEST_E0061.2Conflicting feature flag enables"remove the duplicate"
M057_MANIFEST_E0071.2Invalid edition string"use a supported edition"
M057_MANIFEST_E0081.5Workspace inheritance value not resolvable"set value or remove workspace = true"
M057_MANIFEST_E0091.5Inheritance cycle"break the cycle in workspace.toml"
M057_MANIFEST_E0101.2Capability not in the closed cap set"see Phase 10 §10.1 for the cap vocabulary"
M057_MANIFEST_E0111.2Target name not in the supported set"see Phase 14 for supported targets"
M057_MANIFEST_E0121.2Override declares unknown target"remove or correct target name"

RESOLVE (Phase 2)

CodeOwnerTriggerRecovery hint
M057_RESOLVE_E0012.0Ambiguous import spec"qualify with @scope/name"
M057_RESOLVE_E0022.0No manifest at import path"add mochi.toml to the package root"
M057_RESOLVE_E0032.4@req source pin disagrees with locked version"re-run mochi pkg lock"
M057_RESOLVE_E0042.0Package not found in any registry"check scope/name spelling"
M057_RESOLVE_E0052.0Locked version yanked, no successor"re-run mochi pkg lock --upgrade <pkg>"
M057_RESOLVE_E0062.0Locked package missing from cache (offline)"see Phase 18: vendor or refresh cache"
M057_RESOLVE_E0072.2Cold-cache sentinel (internal)internal
M057_RESOLVE_E0082.3Cache lock contention exceeded timeout"another mochi process holds the lock"
M057_RESOLVE_E0092.3Cache integrity check failed"run mochi pkg cache verify"
M057_RESOLVE_E0102.0Both mochi.toml and mochi.workspace.toml in the same directory"rename or delete one"

WORKSPACE (Phase 3)

CodeOwnerTriggerRecovery hint
M057_WORKSPACE_E0013.0Duplicate member name"rename one of the members"
M057_WORKSPACE_E0023.0Member matches multiple globs"narrow members or use exclude"
M057_WORKSPACE_E0033.7Workspace dependency cycle"break the cycle in member manifests"
M057_WORKSPACE_E0043.0Member glob escapes workspace root"remove .. from the glob"
M057_WORKSPACE_E0053.0Nested workspace (member is itself a workspace root)"demote the nested manifest"

LOCK (Phase 4)

CodeOwnerTriggerRecovery hint
M057_LOCK_E0014.4Manifest changed since lock"re-run mochi pkg lock"
M057_LOCK_E0024.4Resolution drifted (mirror state change)"re-run mochi pkg lock --upgrade"
M057_LOCK_E0034.0Lockfile format version newer than mochi"upgrade mochi to read this lock"
M057_LOCK_E0044.0Lockfile TOML parse failure"do not hand-edit mochi.lock"
M057_LOCK_E0054.0Missing required lock field"regenerate the lockfile"
M057_LOCK_E0064.7New capability appeared without --accept-capabilities"audit the new cap then accept"

SOLVER (Phase 5)

CodeOwnerTriggerRecovery hint
M057_SOLVER_E0015.11Watchdog: exceeded 60s wall or 1M iterations"narrow ranges or split workspaces"
M057_SOLVER_E0025.5Unsatisfiable constraint set (root in conflict)"Phase 6 explanation in the error body"
M057_SOLVER_E0035.10Capability denied: candidate requires caps consumer pin disallows"extend pin or pick another version"
M057_SOLVER_E0045.10Target unsupported: candidate misses a required target"drop target or pick another version"
M057_SOLVER_E0055.10Compiler incompat: candidate's mochi range excludes current"upgrade mochi or pick another version"

INDEX (Phase 7 local registry, Phase 8 sparse index)

CodeOwnerTriggerRecovery hint
M057_INDEX_E0017.6Local index FS read failed"check filesystem permissions"
M057_INDEX_E0028.3Sparse index JSONL parse failure"the registry served malformed data"
M057_INDEX_E0038.9Index format version exceeds client's max known"upgrade mochi"
M057_INDEX_E0048.5Fetch failed after retries"check network/mirror health"
M057_INDEX_E0058.5429 rate-limit not respected by backoff"wait and retry; consider mirror"
M057_INDEX_E00611.2Mirror returned content that diverges from primary"see mochi pkg audit mirror"
M057_INDEX_E0078.7All failover entries exhausted"configure additional mirror"
M057_INDEX_E0087.6Package not found in local index"check name; refresh index"

BLOB (Phase 9 content store, Phase 11 mirror, Phase 18 vendor)

CodeOwnerTriggerRecovery hint
M057_BLOB_E0019.4BLAKE3 of fetched bytes does not match the URL hex"treat the mirror as untrusted"
M057_BLOB_E0029.0Blob fetch partial / connection reset"retried automatically; see logs"
M057_BLOB_E0039.5Tar entry path-escape or absolute path"the publisher tarball is malformed"
M057_BLOB_E0049.5Tar entry exceeds per-entry size cap"see Phase 9 hard limit"
M057_BLOB_E0059.5Tar decompressed size exceeds bomb cap"report to the registry; do not extract"
M057_BLOB_E00618.6Vendor verify: extracted hash does not match lock"the vendor tree was edited"
M057_BLOB_E0077.3Local registry blob 404"check the local registry root"

M057_BLOB_E001 was previously raised by Phases 7, 9, 11, 18 with conflicting semantics. The single owner is Phase 9.4 (BLAKE3 mismatch on extract). Phase 7's 404 is now BLOB_E007. Phase 11's mirror divergence is INDEX_E006. Phase 18's verify mismatch is BLOB_E006.

CAP (Phase 10)

CodeOwnerTriggerRecovery hint
M057_CAP_E00110.3Consumer pin denies a required capability"extend pin or pick another version"
M057_CAP_E00210.5Monotonicity violation: cap added between versions without minor bump"publish a minor bump"
M057_CAP_E00310.7Capability vocabulary unknown to this mochi"upgrade mochi"
M057_CAP_E00410.10.caps.json sidecar does not match resolved tree"re-run mochi pkg lock"
M057_CAP_E00510.5Tarball-time capability re-check disagrees with lock"the package was tampered with"

PUB (Phase 12)

CodeOwnerTriggerRecovery hint
M057_PUB_E00112.0Pre-flight: missing [package].repository"add repository URL"
M057_PUB_E00212.0Pre-flight: working tree dirty"commit or stash before publish"
M057_PUB_E00312.0Pre-flight: version already exists"bump version"
M057_PUB_E00412.5Tarball size exceeds 50MB hard limit"split package"
M057_PUB_E00512.6Registry returned 5xx after retries"check registry status"
M057_PUB_E00612.6Registry returned 401 (auth fail)"refresh MOCHI_TOKEN"
M057_PUB_E00712.0Pre-flight: license string missing or unrecognised"use a valid SPDX expression"
M057_PUB_E00812.0Pre-flight: workspace member cannot be published"publish the workspace root or split"

SIG (Phase 13)

CodeOwnerTriggerRecovery hint
M057_SIG_E00113.0OIDC token unavailable in CI"set permissions: id-token: write"
M057_SIG_E00213.3Fulcio rejected CSR"see Fulcio error in body"
M057_SIG_E00313.4Rekor submission failed after timeout"Rekor may be degraded"
M057_SIG_E00413.6Sigstore bundle signature does not verify"treat as untrusted"
M057_SIG_E00513.6Rekor inclusion proof invalid"treat as untrusted"
M057_SIG_E00613.6OIDC subject does not match publisher binding"verify expected publisher"
M057_SIG_E00713.9Publisher binding API rejected request"check registry binding policy"
M057_SIG_E00813.10TUF root expired or signature invalid"refresh TUF root from pinned source"
M057_SIG_E00913.10TUF metadata rollback detected"abort; report to registry operator"

TUF (Phase 13 metadata client)

SIG_E008 and SIG_E009 cover root + rollback at the trust-root layer. TUF_E* codes cover the targets-metadata client used per fetch (separate sentinels so callers can distinguish "trust root broken" from "this specific target failed").

CodeOwnerTriggerRecovery hint
M057_TUF_E00113.10TUF targets metadata expired or signature invalid"refresh metadata; check clock skew"
M057_TUF_E00213.10TUF target hash/length disagrees with metadata"treat as untrusted; report to operator"

FAN (Phase 14 polyglot fan-out)

CodeOwnerTriggerRecovery hint
M057_FAN_E00114.0Driver unavailable: tool not on PATH"install <tool>"
M057_FAN_E00214.0Target name not in supported set"see Phase 14 supported targets"
M057_FAN_E00314.10Strict mode: per-target failure aborts all"fix the failing target or drop --strict"
M057_FAN_E00414.3-14.8Target-specific schema rejection"see target driver logs"
M057_FAN_E00514.10Rollback: published target cannot be un-published"operator intervention required"

SBOM (Phase 15)

CodeOwnerTriggerRecovery hint
M057_SBOM_E00115.6CycloneDX schema validation failed"see emitted message for field"
M057_SBOM_E00215.6SPDX schema validation failed"see emitted message for field"
M057_SBOM_E00315.3in-toto Statement does not match resolved tree"re-run publish from a clean tree"
M057_SBOM_E00415.4PURL malformed (invalid scope, version, or qualifier)"fix the manifest field surfaced in the message"

ADV (Phase 16 advisory)

CodeOwnerTriggerRecovery hint
M057_ADV_E00116.5Audit found vulnerabilities at or above --fail-on threshold"see hit list; consider ignore"
M057_ADV_E00216.2Advisory feed refresh failed"retry with --refresh"
M057_ADV_E00316.0Advisory YAML schema invalid"advisory author / registry bug"
M057_ADV_E00416.6[ignore-advisories] references unknown ID"remove or update the ignore"

REPRO (Phase 17)

CodeOwnerTriggerRecovery hint
M057_REPRO_E00117.2Tarball contains non-deterministic metadata (xattr, PAX record)"drop the xattr; rebuild"
M057_REPRO_E00217.5Twice-built tarball hashes differ"see phase 17 repro harness"
M057_REPRO_E00317.6Consumer rebuild does not match registry hash"report to publisher; treat as untrusted"
M057_REPRO_E00417.7Source repository tag missing or moved"publisher must re-tag commit"
M057_REPRO_E00517.0SOURCE_DATE_EPOCH not a valid integer"unset or set to seconds since epoch"

OFFLINE (Phase 18)

CodeOwnerTriggerRecovery hint
M057_OFFLINE_E00118.3Cache miss in offline mode"vendor the dep or drop --offline"
M057_OFFLINE_E00218.5Frozen mode: lockfile drift"re-run mochi pkg lock first"
M057_OFFLINE_E00318.7Hard offline: configuration change refused"unset MOCHI_OFFLINE=hard"

CACHE (Phase 19)

CodeOwnerTriggerRecovery hint
M057_CACHE_E00119.6GC raced a concurrent build"the build will retry transparently"
M057_CACHE_E00219.0Hardlink installer hit per-inode limit"fallback to copy is automatic"
M057_CACHE_E00319.6mochi pkg cache verify found tampering"run mochi pkg cache prune"

PERF (Phase 19)

CACHE_* covers correctness of the on-disk cache. PERF_* covers bench-gate and operational failures of GC/install paths, which are recoverable but user-visible.

CodeOwnerTriggerRecovery hint
M057_PERF_E00119.5Bench result exceeds rolling baseline beyond threshold"see bench/baseline.json; investigate regression"
M057_PERF_E00219.6Cache GC failed (filesystem permissions, disk full)"free disk space; check $MOCHI_HOME permissions"
M057_PERF_E00319.0Hardlink failed across filesystems; fell back to copy"internal; logged at debug, not surfaced to user"

Localization policy

The English error sentence is the source of truth for snapshot tests. Renderers may translate the body but must preserve the code (M057_*) verbatim so users can grep dashboards. Phase 6 explanations are localizable; Phase 1-5 messages are not.

Naming convention enforcement

A unit test in pkg/pkgerr/registry_test.go walks every exported sentinel, parses the code, and fails if:

  • the code is not of shape M057_<CATEGORY>_E<NNN>,
  • two sentinels share the same code,
  • a code is gapped (E001, E003 without E002),
  • the owning phase number conflicts with this registry.

The test ships in Phase 0.4 so collisions are caught at PR time.