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