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