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