Skip to main content

aube_codes/
errors.rs

1//! Error codes (`ERR_AUBE_*`).
2//!
3//! Each constant's *value* matches its identifier. The `ALL` slice
4//! is the registry — it gates the generated docs page
5//! (`docs/error-codes.md`, produced by the
6//! `generate-error-codes-docs` binary) and the self-tests in
7//! `lib.rs`. New codes go in both places: define a `pub const`,
8//! then add a [`crate::CodeMeta`] entry to `ALL` carrying the
9//! category, one-line description, and (optional) bespoke exit
10//! code.
11
12use crate::CodeMeta;
13
14// ── lockfile ─────────────────────────────────────────────────────────
15pub const ERR_AUBE_NO_LOCKFILE: &str = "ERR_AUBE_NO_LOCKFILE";
16pub const ERR_AUBE_LOCKFILE_PARSE: &str = "ERR_AUBE_LOCKFILE_PARSE";
17pub const ERR_AUBE_LOCKFILE_UNSUPPORTED_FORMAT: &str = "ERR_AUBE_LOCKFILE_UNSUPPORTED_FORMAT";
18pub const ERR_AUBE_RESOLUTION_SHAPE_MISMATCH: &str = "ERR_AUBE_RESOLUTION_SHAPE_MISMATCH";
19
20// ── resolver ─────────────────────────────────────────────────────────
21pub const ERR_AUBE_NO_MATCHING_VERSION: &str = "ERR_AUBE_NO_MATCHING_VERSION";
22pub const ERR_AUBE_NO_MATURE_MATCHING_VERSION: &str = "ERR_AUBE_NO_MATURE_MATCHING_VERSION";
23pub const ERR_AUBE_REGISTRY_ERROR: &str = "ERR_AUBE_REGISTRY_ERROR";
24pub const ERR_AUBE_UNKNOWN_CATALOG: &str = "ERR_AUBE_UNKNOWN_CATALOG";
25pub const ERR_AUBE_UNKNOWN_CATALOG_ENTRY: &str = "ERR_AUBE_UNKNOWN_CATALOG_ENTRY";
26pub const ERR_AUBE_BLOCKED_EXOTIC_SUBDEP: &str = "ERR_AUBE_BLOCKED_EXOTIC_SUBDEP";
27pub const ERR_AUBE_TRUST_DOWNGRADE: &str = "ERR_AUBE_TRUST_DOWNGRADE";
28pub const ERR_AUBE_TRUST_MISSING_TIME: &str = "ERR_AUBE_TRUST_MISSING_TIME";
29// `#[rustfmt::skip]` keeps the long names on a single visual line so the
30// declaration list reads as a flat table — rustfmt would otherwise wrap
31// to a `name: &str =\n    "name";` two-liner for any const past col 100.
32#[rustfmt::skip] pub const ERR_AUBE_TRUST_EXCLUDE_INVALID_VERSION_UNION: &str = "ERR_AUBE_TRUST_EXCLUDE_INVALID_VERSION_UNION";
33#[rustfmt::skip] pub const ERR_AUBE_TRUST_EXCLUDE_NAME_GLOB_WITH_VERSIONS: &str = "ERR_AUBE_TRUST_EXCLUDE_NAME_GLOB_WITH_VERSIONS";
34pub const ERR_AUBE_PEER_CONTEXT_NOT_CONVERGED: &str = "ERR_AUBE_PEER_CONTEXT_NOT_CONVERGED";
35
36// ── registry / network ──────────────────────────────────────────────
37pub const ERR_AUBE_PACKAGE_NOT_FOUND: &str = "ERR_AUBE_PACKAGE_NOT_FOUND";
38pub const ERR_AUBE_ACCESS_ENTITY_NOT_FOUND: &str = "ERR_AUBE_ACCESS_ENTITY_NOT_FOUND";
39pub const ERR_AUBE_VERSION_NOT_FOUND: &str = "ERR_AUBE_VERSION_NOT_FOUND";
40pub const ERR_AUBE_UNAUTHORIZED: &str = "ERR_AUBE_UNAUTHORIZED";
41pub const ERR_AUBE_OFFLINE: &str = "ERR_AUBE_OFFLINE";
42pub const ERR_AUBE_INVALID_PACKAGE_NAME: &str = "ERR_AUBE_INVALID_PACKAGE_NAME";
43pub const ERR_AUBE_REGISTRY_WRITE_REJECTED: &str = "ERR_AUBE_REGISTRY_WRITE_REJECTED";
44pub const ERR_AUBE_MALICIOUS_PACKAGE: &str = "ERR_AUBE_MALICIOUS_PACKAGE";
45pub const ERR_AUBE_LOW_DOWNLOAD_PACKAGE: &str = "ERR_AUBE_LOW_DOWNLOAD_PACKAGE";
46pub const ERR_AUBE_ADVISORY_CHECK_FAILED: &str = "ERR_AUBE_ADVISORY_CHECK_FAILED";
47pub const ERR_AUBE_SECURITY_SCANNER_FATAL: &str = "ERR_AUBE_SECURITY_SCANNER_FATAL";
48pub const ERR_AUBE_SECURITY_SCANNER_FAILED: &str = "ERR_AUBE_SECURITY_SCANNER_FAILED";
49
50// ── tarball / store ─────────────────────────────────────────────────
51pub const ERR_AUBE_TARBALL_INTEGRITY: &str = "ERR_AUBE_TARBALL_INTEGRITY";
52pub const ERR_AUBE_TARBALL_EXTRACT: &str = "ERR_AUBE_TARBALL_EXTRACT";
53pub const ERR_AUBE_PKG_CONTENT_MISMATCH: &str = "ERR_AUBE_PKG_CONTENT_MISMATCH";
54pub const ERR_AUBE_TARBALL_URL_MISMATCH: &str = "ERR_AUBE_TARBALL_URL_MISMATCH";
55pub const ERR_AUBE_NO_HOME: &str = "ERR_AUBE_NO_HOME";
56pub const ERR_AUBE_GIT_ERROR: &str = "ERR_AUBE_GIT_ERROR";
57
58// ── linker ──────────────────────────────────────────────────────────
59pub const ERR_AUBE_LINK_FAILED: &str = "ERR_AUBE_LINK_FAILED";
60pub const ERR_AUBE_PATCH_FAILED: &str = "ERR_AUBE_PATCH_FAILED";
61pub const ERR_AUBE_MISSING_PACKAGE_INDEX: &str = "ERR_AUBE_MISSING_PACKAGE_INDEX";
62pub const ERR_AUBE_UNSAFE_INDEX_KEY: &str = "ERR_AUBE_UNSAFE_INDEX_KEY";
63pub const ERR_AUBE_UNSAFE_PACKAGE_NAME: &str = "ERR_AUBE_UNSAFE_PACKAGE_NAME";
64pub const ERR_AUBE_MISSING_STORE_FILE: &str = "ERR_AUBE_MISSING_STORE_FILE";
65
66// ── scripts ─────────────────────────────────────────────────────────
67pub const ERR_AUBE_SCRIPT_SPAWN: &str = "ERR_AUBE_SCRIPT_SPAWN";
68pub const ERR_AUBE_SCRIPT_NON_ZERO_EXIT: &str = "ERR_AUBE_SCRIPT_NON_ZERO_EXIT";
69#[rustfmt::skip] pub const ERR_AUBE_BUILD_POLICY_UNSUPPORTED_VALUE: &str = "ERR_AUBE_BUILD_POLICY_UNSUPPORTED_VALUE";
70#[rustfmt::skip] pub const ERR_AUBE_BUILD_POLICY_INVALID_VERSION_UNION: &str = "ERR_AUBE_BUILD_POLICY_INVALID_VERSION_UNION";
71#[rustfmt::skip] pub const ERR_AUBE_BUILD_POLICY_WILDCARD_WITH_VERSION: &str = "ERR_AUBE_BUILD_POLICY_WILDCARD_WITH_VERSION";
72
73// ── workspace / filter ──────────────────────────────────────────────
74pub const ERR_AUBE_WORKSPACE_PARSE: &str = "ERR_AUBE_WORKSPACE_PARSE";
75pub const ERR_AUBE_FILTER_EMPTY: &str = "ERR_AUBE_FILTER_EMPTY";
76pub const ERR_AUBE_FILTER_GIT_IO: &str = "ERR_AUBE_FILTER_GIT_IO";
77pub const ERR_AUBE_FILTER_GIT_FAILED: &str = "ERR_AUBE_FILTER_GIT_FAILED";
78
79// ── manifest ────────────────────────────────────────────────────────
80pub const ERR_AUBE_MANIFEST_PARSE: &str = "ERR_AUBE_MANIFEST_PARSE";
81pub const ERR_AUBE_MANIFEST_YAML_PARSE: &str = "ERR_AUBE_MANIFEST_YAML_PARSE";
82
83// ── engine / cli ────────────────────────────────────────────────────
84pub const ERR_AUBE_UNSUPPORTED_ENGINE: &str = "ERR_AUBE_UNSUPPORTED_ENGINE";
85pub const ERR_AUBE_RECURSIVE_NOT_SUPPORTED: &str = "ERR_AUBE_RECURSIVE_NOT_SUPPORTED";
86pub const ERR_AUBE_UNKNOWN_COMMAND: &str = "ERR_AUBE_UNKNOWN_COMMAND";
87pub const ERR_AUBE_NPM_ONLY_COMMAND: &str = "ERR_AUBE_NPM_ONLY_COMMAND";
88pub const ERR_AUBE_COMPLETION_FAILED: &str = "ERR_AUBE_COMPLETION_FAILED";
89pub const ERR_AUBE_REMOVE_PRIOR_INSTALL_DIR: &str = "ERR_AUBE_REMOVE_PRIOR_INSTALL_DIR";
90pub const ERR_AUBE_CONFIG_NESTED_AUBE_KEY: &str = "ERR_AUBE_CONFIG_NESTED_AUBE_KEY";
91pub const ERR_AUBE_CONFLICTING_BUILD_FLAGS: &str = "ERR_AUBE_CONFLICTING_BUILD_FLAGS";
92pub const ERR_AUBE_ACCESS_INVALID_ARGUMENT: &str = "ERR_AUBE_ACCESS_INVALID_ARGUMENT";
93pub const ERR_AUBE_SHIM_CREATE_FAILED: &str = "ERR_AUBE_SHIM_CREATE_FAILED";
94pub const ERR_AUBE_SHIM_EXEC_FAILED: &str = "ERR_AUBE_SHIM_EXEC_FAILED";
95
96// ── node runtime (devEngines.runtime / .node-version / .nvmrc) ──────
97#[rustfmt::skip] pub const ERR_AUBE_RUNTIME_VERSION_UNSATISFIED: &str = "ERR_AUBE_RUNTIME_VERSION_UNSATISFIED";
98#[rustfmt::skip] pub const ERR_AUBE_RUNTIME_NO_MATCHING_VERSION: &str = "ERR_AUBE_RUNTIME_NO_MATCHING_VERSION";
99pub const ERR_AUBE_RUNTIME_DOWNLOAD_FAILED: &str = "ERR_AUBE_RUNTIME_DOWNLOAD_FAILED";
100#[rustfmt::skip] pub const ERR_AUBE_RUNTIME_CHECKSUM_MISMATCH: &str = "ERR_AUBE_RUNTIME_CHECKSUM_MISMATCH";
101pub const ERR_AUBE_RUNTIME_EXTRACT_FAILED: &str = "ERR_AUBE_RUNTIME_EXTRACT_FAILED";
102#[rustfmt::skip] pub const ERR_AUBE_RUNTIME_MISE_INSTALL_FAILED: &str = "ERR_AUBE_RUNTIME_MISE_INSTALL_FAILED";
103#[rustfmt::skip] pub const ERR_AUBE_RUNTIME_UNSUPPORTED_PLATFORM: &str = "ERR_AUBE_RUNTIME_UNSUPPORTED_PLATFORM";
104pub const ERR_AUBE_RUNTIME_IO: &str = "ERR_AUBE_RUNTIME_IO";
105
106// ── misc tracing::error! sites (non-fatal but high-severity) ────────
107pub const ERR_AUBE_PATCHES_TRACKING_WRITE: &str = "ERR_AUBE_PATCHES_TRACKING_WRITE";
108pub const ERR_AUBE_UNSAFE_SHEBANG_INTERPRETER: &str = "ERR_AUBE_UNSAFE_SHEBANG_INTERPRETER";
109
110/// Stable category labels that group codes in the generated docs and
111/// in `EXIT_TABLE`'s 10-wide allocation ranges. Public so the docs
112/// generator can iterate them in a deterministic order.
113pub mod category {
114    pub const LOCKFILE: &str = "Lockfile";
115    pub const RESOLVER: &str = "Resolver";
116    pub const TARBALL_STORE: &str = "Tarball / store";
117    pub const REGISTRY_NETWORK: &str = "Registry / network";
118    pub const SCRIPTS: &str = "Scripts / build";
119    pub const LINKER: &str = "Linker";
120    pub const MANIFEST_WORKSPACE: &str = "Manifest / workspace";
121    pub const ENGINE_CLI: &str = "Engine / CLI";
122    pub const MISC_SAFETY: &str = "Misc / safety";
123    /// Add-time / install-time supply-chain policy errors. Paired
124    /// with [`crate::warnings::category::SUPPLY_CHAIN`].
125    pub const SUPPLY_CHAIN: &str = "Supply chain (add-time)";
126}
127
128/// Registry of every error code with its category, description, and
129/// (optional) bespoke exit code. Walked by the
130/// `generate-error-codes-docs` binary and by the self-tests in
131/// `lib.rs` and `exit.rs`. New codes must be added here.
132pub const ALL: &[CodeMeta] = &[
133    // Lockfile
134    CodeMeta {
135        name: ERR_AUBE_NO_LOCKFILE,
136        category: category::LOCKFILE,
137        description: "An operation that required a lockfile (`--frozen-lockfile`, `aube fetch`, etc.) found none in the project.",
138        exit_code: Some(10),
139    },
140    CodeMeta {
141        name: ERR_AUBE_LOCKFILE_PARSE,
142        category: category::LOCKFILE,
143        description: "Lockfile is structurally invalid — version guard failed, YAML shape is wrong, or `yaml_serde` couldn't round-trip the contents.",
144        exit_code: Some(11),
145    },
146    CodeMeta {
147        name: ERR_AUBE_LOCKFILE_UNSUPPORTED_FORMAT,
148        category: category::LOCKFILE,
149        description: "Lockfile filename was recognized but its format isn't supported on this aube version.",
150        exit_code: Some(12),
151    },
152    CodeMeta {
153        name: ERR_AUBE_RESOLUTION_SHAPE_MISMATCH,
154        category: category::LOCKFILE,
155        description: "A registry-style lockfile dependency path is backed by a git, local directory, or direct tarball resolution.",
156        exit_code: Some(13),
157    },
158    // Resolver
159    CodeMeta {
160        name: ERR_AUBE_NO_MATCHING_VERSION,
161        category: category::RESOLVER,
162        description: "No published version of the named package satisfies the requested range.",
163        exit_code: Some(20),
164    },
165    CodeMeta {
166        name: ERR_AUBE_NO_MATURE_MATCHING_VERSION,
167        category: category::RESOLVER,
168        description: "A version satisfying the range exists but every candidate was younger than `minimumReleaseAge` and `minimumReleaseAgeStrict=true`.",
169        exit_code: Some(21),
170    },
171    CodeMeta {
172        name: ERR_AUBE_BLOCKED_EXOTIC_SUBDEP,
173        category: category::RESOLVER,
174        description: "Transitive dep used a `git:` / `file:` / `tarball` specifier and `blockExoticSubdeps=true`.",
175        exit_code: Some(22),
176    },
177    CodeMeta {
178        name: ERR_AUBE_TRUST_DOWNGRADE,
179        category: category::RESOLVER,
180        description: "Picked version dropped trust evidence the prior version had (`trustPolicy=no-downgrade`).",
181        exit_code: Some(23),
182    },
183    CodeMeta {
184        name: ERR_AUBE_TRUST_MISSING_TIME,
185        category: category::RESOLVER,
186        description: "Registry's packument has no `time` entry for the picked version (`trustPolicy=no-downgrade`).",
187        exit_code: Some(24),
188    },
189    CodeMeta {
190        name: ERR_AUBE_UNKNOWN_CATALOG,
191        category: category::RESOLVER,
192        description: "A `catalog:<name>` reference was used but the catalog isn't defined.",
193        exit_code: Some(25),
194    },
195    CodeMeta {
196        name: ERR_AUBE_UNKNOWN_CATALOG_ENTRY,
197        category: category::RESOLVER,
198        description: "The catalog exists but has no entry for the requested package.",
199        exit_code: Some(26),
200    },
201    CodeMeta {
202        name: ERR_AUBE_PEER_CONTEXT_NOT_CONVERGED,
203        category: category::RESOLVER,
204        description: "Peer-context fixed-point loop hit `MAX_ITERATIONS=16` without converging — usually mutually-recursive peers.",
205        exit_code: Some(27),
206    },
207    CodeMeta {
208        name: ERR_AUBE_REGISTRY_ERROR,
209        category: category::RESOLVER,
210        description: "Generic registry error from inside the resolver.",
211        exit_code: None,
212    },
213    CodeMeta {
214        name: ERR_AUBE_TRUST_EXCLUDE_INVALID_VERSION_UNION,
215        category: category::RESOLVER,
216        description: "A `trustPolicyExclude` pattern had an invalid semver range.",
217        exit_code: None,
218    },
219    CodeMeta {
220        name: ERR_AUBE_TRUST_EXCLUDE_NAME_GLOB_WITH_VERSIONS,
221        category: category::RESOLVER,
222        description: "A `trustPolicyExclude` pattern combined a name glob with versions.",
223        exit_code: None,
224    },
225    // Tarball / store
226    CodeMeta {
227        name: ERR_AUBE_TARBALL_INTEGRITY,
228        category: category::TARBALL_STORE,
229        description: "Downloaded tarball's hash didn't match the lockfile's / packument's `dist.integrity`.",
230        exit_code: Some(30),
231    },
232    CodeMeta {
233        name: ERR_AUBE_TARBALL_EXTRACT,
234        category: category::TARBALL_STORE,
235        description: "Tarball couldn't be extracted (corrupt gzip, unexpected entry shape, etc.).",
236        exit_code: Some(31),
237    },
238    CodeMeta {
239        name: ERR_AUBE_PKG_CONTENT_MISMATCH,
240        category: category::TARBALL_STORE,
241        description: "Tarball's `package.json` declared a different `(name, version)` than the resolver expected (`strictStorePkgContentCheck=true`).",
242        exit_code: Some(32),
243    },
244    CodeMeta {
245        name: ERR_AUBE_GIT_ERROR,
246        category: category::TARBALL_STORE,
247        description: "Git operation failed during a `git:` dep prepare or checkout.",
248        exit_code: Some(33),
249    },
250    CodeMeta {
251        name: ERR_AUBE_TARBALL_URL_MISMATCH,
252        category: category::TARBALL_STORE,
253        description: "A registry lockfile entry's explicit tarball URL didn't match the registry metadata for that `(name, version)`.",
254        exit_code: Some(34),
255    },
256    CodeMeta {
257        name: ERR_AUBE_NO_HOME,
258        category: category::TARBALL_STORE,
259        description: "`HOME` (or platform equivalent) is unset, so aube can't locate its store.",
260        exit_code: None,
261    },
262    // Registry / network
263    CodeMeta {
264        name: ERR_AUBE_PACKAGE_NOT_FOUND,
265        category: category::REGISTRY_NETWORK,
266        description: "Registry returned 404 for the package name.",
267        exit_code: Some(40),
268    },
269    CodeMeta {
270        name: ERR_AUBE_ACCESS_ENTITY_NOT_FOUND,
271        category: category::REGISTRY_NETWORK,
272        description: "Registry returned 404 for an access user, organization, or team.",
273        exit_code: None,
274    },
275    CodeMeta {
276        name: ERR_AUBE_VERSION_NOT_FOUND,
277        category: category::REGISTRY_NETWORK,
278        description: "Package exists but the requested version doesn't.",
279        exit_code: Some(41),
280    },
281    CodeMeta {
282        name: ERR_AUBE_UNAUTHORIZED,
283        category: category::REGISTRY_NETWORK,
284        description: "Registry returned 401/403 — missing or invalid auth. Run `aube login`.",
285        exit_code: Some(42),
286    },
287    CodeMeta {
288        name: ERR_AUBE_OFFLINE,
289        category: category::REGISTRY_NETWORK,
290        description: "Offline mode and the requested resource isn't in the local cache.",
291        exit_code: Some(43),
292    },
293    CodeMeta {
294        name: ERR_AUBE_INVALID_PACKAGE_NAME,
295        category: category::REGISTRY_NETWORK,
296        description: "A name doesn't match npm's grammar — rejected before any I/O so a hostile manifest can't use the cache-path builder as a write primitive.",
297        exit_code: Some(44),
298    },
299    CodeMeta {
300        name: ERR_AUBE_REGISTRY_WRITE_REJECTED,
301        category: category::REGISTRY_NETWORK,
302        description: "Registry rejected a publish/deprecate/owner write with a non-2xx response.",
303        exit_code: Some(45),
304    },
305    CodeMeta {
306        name: ERR_AUBE_MALICIOUS_PACKAGE,
307        category: category::REGISTRY_NETWORK,
308        description: "`aube add` refused a package because OSV reports it as malicious (`MAL-*` advisory). Hard block — confirmed-malicious advisories aren't a judgement call.",
309        exit_code: Some(46),
310    },
311    CodeMeta {
312        name: ERR_AUBE_LOW_DOWNLOAD_PACKAGE,
313        category: category::REGISTRY_NETWORK,
314        description: "`aube add` refused a package whose weekly downloads fall below `lowDownloadThreshold` in a non-interactive context (or when stdin is not a TTY). Pass `--allow-low-downloads` to bypass.",
315        exit_code: Some(47),
316    },
317    CodeMeta {
318        name: ERR_AUBE_ADVISORY_CHECK_FAILED,
319        category: category::REGISTRY_NETWORK,
320        description: "`aube add` couldn't reach the OSV advisory API and `advisoryCheck = required` is set. Distinct from `ERR_AUBE_MALICIOUS_PACKAGE` so CI tooling can tell a network outage from a confirmed malicious advisory.",
321        exit_code: Some(49),
322    },
323    CodeMeta {
324        name: ERR_AUBE_SECURITY_SCANNER_FATAL,
325        category: category::SUPPLY_CHAIN,
326        description: "User-configured `securityScanner` returned a `fatal`-level advisory against a package the user is trying to add. Bun-style pluggable scanner contract; the scanner itself decides what counts as fatal.",
327        exit_code: Some(48),
328    },
329    CodeMeta {
330        name: ERR_AUBE_SECURITY_SCANNER_FAILED,
331        category: category::SUPPLY_CHAIN,
332        description: "User-configured `securityScanner` couldn't be spawned, exited non-zero, timed out, or emitted unparseable JSON. Fail-closed by design: a configured scanner that can't run is treated as a refusal, not a free pass. Set `securityScanner = \"\"` to disable the integration when bootstrapping or recovering from a broken scanner.",
333        exit_code: None,
334    },
335    // Scripts / build
336    CodeMeta {
337        name: ERR_AUBE_SCRIPT_NON_ZERO_EXIT,
338        category: category::SCRIPTS,
339        description: "A lifecycle script (`preinstall` / `install` / `postinstall` / a `package.json` script) exited non-zero.",
340        exit_code: Some(50),
341    },
342    CodeMeta {
343        name: ERR_AUBE_SCRIPT_SPAWN,
344        category: category::SCRIPTS,
345        description: "Couldn't spawn a script's interpreter (shell missing, jail setup failed, etc.).",
346        exit_code: Some(51),
347    },
348    CodeMeta {
349        name: ERR_AUBE_BUILD_POLICY_UNSUPPORTED_VALUE,
350        category: category::SCRIPTS,
351        description: "An entry in `allowBuilds` had a value that wasn't `true`/`false`.",
352        exit_code: None,
353    },
354    CodeMeta {
355        name: ERR_AUBE_BUILD_POLICY_INVALID_VERSION_UNION,
356        category: category::SCRIPTS,
357        description: "An `allowBuilds` pattern's version union was unparseable.",
358        exit_code: None,
359    },
360    CodeMeta {
361        name: ERR_AUBE_BUILD_POLICY_WILDCARD_WITH_VERSION,
362        category: category::SCRIPTS,
363        description: "An `allowBuilds` pattern combined a wildcard name with a version union.",
364        exit_code: None,
365    },
366    // Linker
367    CodeMeta {
368        name: ERR_AUBE_PATCH_FAILED,
369        category: category::LINKER,
370        description: "Applying a `pnpm.patchedDependencies` patch failed.",
371        exit_code: Some(60),
372    },
373    CodeMeta {
374        name: ERR_AUBE_LINK_FAILED,
375        category: category::LINKER,
376        description: "Symlink / junction / hardlink couldn't be created — usually permissions or filesystem support.",
377        exit_code: Some(61),
378    },
379    CodeMeta {
380        name: ERR_AUBE_MISSING_PACKAGE_INDEX,
381        category: category::LINKER,
382        description: "Internal: a caller skipped `load_index` but the package wasn't already materialized.",
383        exit_code: Some(62),
384    },
385    CodeMeta {
386        name: ERR_AUBE_MISSING_STORE_FILE,
387        category: category::LINKER,
388        description: "A package index references a CAS shard that doesn't exist on disk. Re-run install to re-fetch.",
389        exit_code: Some(63),
390    },
391    // Manifest / workspace
392    CodeMeta {
393        name: ERR_AUBE_MANIFEST_PARSE,
394        category: category::MANIFEST_WORKSPACE,
395        description: "A `package.json` had a syntax error. miette renders a pointer at the offending byte.",
396        exit_code: Some(70),
397    },
398    CodeMeta {
399        name: ERR_AUBE_WORKSPACE_PARSE,
400        category: category::MANIFEST_WORKSPACE,
401        description: "An `aube-workspace.yaml` / `pnpm-workspace.yaml` was structurally invalid.",
402        exit_code: Some(71),
403    },
404    CodeMeta {
405        name: ERR_AUBE_MANIFEST_YAML_PARSE,
406        category: category::MANIFEST_WORKSPACE,
407        description: "A workspace YAML helper file was structurally invalid (no source pointer available).",
408        exit_code: None,
409    },
410    CodeMeta {
411        name: ERR_AUBE_FILTER_EMPTY,
412        category: category::MANIFEST_WORKSPACE,
413        description: "`--filter` was passed an empty selector.",
414        exit_code: None,
415    },
416    CodeMeta {
417        name: ERR_AUBE_FILTER_GIT_IO,
418        category: category::MANIFEST_WORKSPACE,
419        description: "A `--filter ...[ref]` selector failed to spawn `git`.",
420        exit_code: None,
421    },
422    CodeMeta {
423        name: ERR_AUBE_FILTER_GIT_FAILED,
424        category: category::MANIFEST_WORKSPACE,
425        description: "The git subprocess for a `--filter ...[ref]` selector exited non-zero.",
426        exit_code: None,
427    },
428    // Engine / CLI
429    CodeMeta {
430        name: ERR_AUBE_UNSUPPORTED_ENGINE,
431        category: category::ENGINE_CLI,
432        description: "One or more packages declared an `engines` constraint incompatible with the running Node/aube and `engine-strict=true`.",
433        exit_code: Some(80),
434    },
435    CodeMeta {
436        name: ERR_AUBE_UNKNOWN_COMMAND,
437        category: category::ENGINE_CLI,
438        description: "The named subcommand isn't a built-in aube command and isn't a script in the manifest.",
439        exit_code: Some(81),
440    },
441    CodeMeta {
442        name: ERR_AUBE_NPM_ONLY_COMMAND,
443        category: category::ENGINE_CLI,
444        description: "The user invoked an npm-only command (`whoami`, `token`, `owner`, `search`, `pkg`, `set-script`) — aube doesn't implement these; use npm.",
445        exit_code: Some(82),
446    },
447    CodeMeta {
448        name: ERR_AUBE_RECURSIVE_NOT_SUPPORTED,
449        category: category::ENGINE_CLI,
450        description: "A command was invoked under `--recursive` but doesn't support recursive execution.",
451        exit_code: None,
452    },
453    CodeMeta {
454        name: ERR_AUBE_COMPLETION_FAILED,
455        category: category::ENGINE_CLI,
456        description: "`aube completion` couldn't invoke `usage` to render the shell completions.",
457        exit_code: None,
458    },
459    CodeMeta {
460        name: ERR_AUBE_REMOVE_PRIOR_INSTALL_DIR,
461        category: category::ENGINE_CLI,
462        description: "Couldn't clean up a prior global install dir before re-installing.",
463        exit_code: None,
464    },
465    CodeMeta {
466        name: ERR_AUBE_CONFIG_NESTED_AUBE_KEY,
467        category: category::ENGINE_CLI,
468        description: "`aube config set <prefix>.<sub> …` was used for a key whose prefix is an aube map setting (e.g. `allowBuilds.<pkg>`). Such nested writes would otherwise land in `.npmrc` where aube doesn't read them and npm warns/errors about the unknown key — set the map in workspace yaml or `package.json#aube.<prefix>` instead.",
469        exit_code: None,
470    },
471    CodeMeta {
472        name: ERR_AUBE_CONFLICTING_BUILD_FLAGS,
473        category: category::ENGINE_CLI,
474        description: "`aube add` was passed the same package name in both `--allow-build` and `--deny-build`.",
475        exit_code: None,
476    },
477    CodeMeta {
478        name: ERR_AUBE_ACCESS_INVALID_ARGUMENT,
479        category: category::ENGINE_CLI,
480        description: "`aube access` received an invalid access setting, permission level, team, or package argument.",
481        exit_code: None,
482    },
483    CodeMeta {
484        name: ERR_AUBE_SHIM_CREATE_FAILED,
485        category: category::ENGINE_CLI,
486        description: "`aube activate <shell>` couldn't create or refresh an executable shim in aube's shim directory.",
487        exit_code: None,
488    },
489    CodeMeta {
490        name: ERR_AUBE_SHIM_EXEC_FAILED,
491        category: category::ENGINE_CLI,
492        description: "A runtime tool shim resolved its target but couldn't exec or spawn the selected tool.",
493        exit_code: None,
494    },
495    // Node runtime (devEngines.runtime / .node-version / .nvmrc)
496    CodeMeta {
497        name: ERR_AUBE_RUNTIME_VERSION_UNSATISFIED,
498        category: category::ENGINE_CLI,
499        description: "The project requires a Node.js version that isn't available and policy forbids fetching it (`devEngines.runtime` with `onFail: \"error\"`, `runtimeOnFail=error`, or offline mode with nothing installed).",
500        exit_code: Some(83),
501    },
502    CodeMeta {
503        name: ERR_AUBE_RUNTIME_NO_MATCHING_VERSION,
504        category: category::ENGINE_CLI,
505        description: "No Node.js release in the dist index satisfies the requested version (bad range, unknown LTS codename, or no build for this platform).",
506        exit_code: Some(84),
507    },
508    CodeMeta {
509        name: ERR_AUBE_RUNTIME_DOWNLOAD_FAILED,
510        category: category::ENGINE_CLI,
511        description: "Fetching the Node.js dist index, checksum file, or release archive failed after retries.",
512        exit_code: Some(85),
513    },
514    CodeMeta {
515        name: ERR_AUBE_RUNTIME_CHECKSUM_MISMATCH,
516        category: category::ENGINE_CLI,
517        description: "A downloaded Node.js archive's SHA-256 didn't match the lockfile pin or `SHASUMS256.txt`. The archive is discarded and never retried automatically.",
518        exit_code: Some(86),
519    },
520    CodeMeta {
521        name: ERR_AUBE_RUNTIME_EXTRACT_FAILED,
522        category: category::ENGINE_CLI,
523        description: "A Node.js release archive was corrupt or contained unsafe entry paths.",
524        exit_code: Some(87),
525    },
526    CodeMeta {
527        name: ERR_AUBE_RUNTIME_MISE_INSTALL_FAILED,
528        category: category::ENGINE_CLI,
529        description: "Delegating a Node.js install to mise failed — `mise install node@<version>` exited non-zero or the install wasn't discoverable afterwards. Fatal only under `runtimeInstaller=mise`; `auto` falls back to aube's own download.",
530        exit_code: Some(88),
531    },
532    CodeMeta {
533        name: ERR_AUBE_RUNTIME_UNSUPPORTED_PLATFORM,
534        category: category::ENGINE_CLI,
535        description: "No official Node.js build exists for this OS/architecture/libc. Set `nodeDownloadMirrors` to a mirror that carries one, or install Node via mise/system.",
536        exit_code: Some(89),
537    },
538    CodeMeta {
539        name: ERR_AUBE_RUNTIME_IO,
540        category: category::ENGINE_CLI,
541        description: "A filesystem operation in the runtime store failed (lock acquisition, staging, or publishing an install). Not a download failure — the message names the failing path.",
542        exit_code: None,
543    },
544    // Misc / safety
545    CodeMeta {
546        name: ERR_AUBE_UNSAFE_INDEX_KEY,
547        category: category::MISC_SAFETY,
548        description: "A package index key tried to escape its directory (path traversal defense in depth).",
549        exit_code: Some(90),
550    },
551    CodeMeta {
552        name: ERR_AUBE_UNSAFE_SHEBANG_INTERPRETER,
553        category: category::MISC_SAFETY,
554        description: "A `#!` shebang named an unsafe interpreter when generating a shim — substituted with `node` instead. Surfaced as `tracing::error!` but install continues.",
555        exit_code: Some(91),
556    },
557    CodeMeta {
558        name: ERR_AUBE_UNSAFE_PACKAGE_NAME,
559        category: category::MISC_SAFETY,
560        description: "A package/dependency alias would escape its `node_modules` slot if linked.",
561        exit_code: Some(92),
562    },
563    CodeMeta {
564        name: ERR_AUBE_PATCHES_TRACKING_WRITE,
565        category: category::MISC_SAFETY,
566        description: "Couldn't write `.aube-applied-patches.json` after applying patches. Non-fatal; next install may miss stale patched entries.",
567        exit_code: None,
568    },
569];