Skip to main content

aube_codes/
errors.rs

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