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