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