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