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