aube-codes 1.8.0

Stable error and warning code identifiers shared across the aube workspace.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
//! Error codes (`ERR_AUBE_*`).
//!
//! Each constant's *value* matches its identifier. The `ALL` slice
//! is the registry — it gates the generated docs page
//! (`docs/error-codes.md`, produced by the
//! `generate-error-codes-docs` binary) and the self-tests in
//! `lib.rs`. New codes go in both places: define a `pub const`,
//! then add a [`crate::CodeMeta`] entry to `ALL` carrying the
//! category, one-line description, and (optional) bespoke exit
//! code.

use crate::CodeMeta;

// ── lockfile ─────────────────────────────────────────────────────────
pub const ERR_AUBE_NO_LOCKFILE: &str = "ERR_AUBE_NO_LOCKFILE";
pub const ERR_AUBE_LOCKFILE_PARSE: &str = "ERR_AUBE_LOCKFILE_PARSE";
pub const ERR_AUBE_LOCKFILE_UNSUPPORTED_FORMAT: &str = "ERR_AUBE_LOCKFILE_UNSUPPORTED_FORMAT";

// ── resolver ─────────────────────────────────────────────────────────
pub const ERR_AUBE_NO_MATCHING_VERSION: &str = "ERR_AUBE_NO_MATCHING_VERSION";
pub const ERR_AUBE_NO_MATURE_MATCHING_VERSION: &str = "ERR_AUBE_NO_MATURE_MATCHING_VERSION";
pub const ERR_AUBE_REGISTRY_ERROR: &str = "ERR_AUBE_REGISTRY_ERROR";
pub const ERR_AUBE_UNKNOWN_CATALOG: &str = "ERR_AUBE_UNKNOWN_CATALOG";
pub const ERR_AUBE_UNKNOWN_CATALOG_ENTRY: &str = "ERR_AUBE_UNKNOWN_CATALOG_ENTRY";
pub const ERR_AUBE_BLOCKED_EXOTIC_SUBDEP: &str = "ERR_AUBE_BLOCKED_EXOTIC_SUBDEP";
pub const ERR_AUBE_TRUST_DOWNGRADE: &str = "ERR_AUBE_TRUST_DOWNGRADE";
pub const ERR_AUBE_TRUST_MISSING_TIME: &str = "ERR_AUBE_TRUST_MISSING_TIME";
// `#[rustfmt::skip]` keeps the long names on a single visual line so the
// declaration list reads as a flat table — rustfmt would otherwise wrap
// to a `name: &str =\n    "name";` two-liner for any const past col 100.
#[rustfmt::skip] pub const ERR_AUBE_TRUST_EXCLUDE_INVALID_VERSION_UNION: &str = "ERR_AUBE_TRUST_EXCLUDE_INVALID_VERSION_UNION";
#[rustfmt::skip] pub const ERR_AUBE_TRUST_EXCLUDE_NAME_GLOB_WITH_VERSIONS: &str = "ERR_AUBE_TRUST_EXCLUDE_NAME_GLOB_WITH_VERSIONS";
pub const ERR_AUBE_PEER_CONTEXT_NOT_CONVERGED: &str = "ERR_AUBE_PEER_CONTEXT_NOT_CONVERGED";

// ── registry / network ──────────────────────────────────────────────
pub const ERR_AUBE_PACKAGE_NOT_FOUND: &str = "ERR_AUBE_PACKAGE_NOT_FOUND";
pub const ERR_AUBE_VERSION_NOT_FOUND: &str = "ERR_AUBE_VERSION_NOT_FOUND";
pub const ERR_AUBE_UNAUTHORIZED: &str = "ERR_AUBE_UNAUTHORIZED";
pub const ERR_AUBE_OFFLINE: &str = "ERR_AUBE_OFFLINE";
pub const ERR_AUBE_INVALID_PACKAGE_NAME: &str = "ERR_AUBE_INVALID_PACKAGE_NAME";
pub const ERR_AUBE_REGISTRY_WRITE_REJECTED: &str = "ERR_AUBE_REGISTRY_WRITE_REJECTED";

// ── tarball / store ─────────────────────────────────────────────────
pub const ERR_AUBE_TARBALL_INTEGRITY: &str = "ERR_AUBE_TARBALL_INTEGRITY";
pub const ERR_AUBE_TARBALL_EXTRACT: &str = "ERR_AUBE_TARBALL_EXTRACT";
pub const ERR_AUBE_PKG_CONTENT_MISMATCH: &str = "ERR_AUBE_PKG_CONTENT_MISMATCH";
pub const ERR_AUBE_NO_HOME: &str = "ERR_AUBE_NO_HOME";
pub const ERR_AUBE_GIT_ERROR: &str = "ERR_AUBE_GIT_ERROR";

// ── linker ──────────────────────────────────────────────────────────
pub const ERR_AUBE_LINK_FAILED: &str = "ERR_AUBE_LINK_FAILED";
pub const ERR_AUBE_PATCH_FAILED: &str = "ERR_AUBE_PATCH_FAILED";
pub const ERR_AUBE_MISSING_PACKAGE_INDEX: &str = "ERR_AUBE_MISSING_PACKAGE_INDEX";
pub const ERR_AUBE_UNSAFE_INDEX_KEY: &str = "ERR_AUBE_UNSAFE_INDEX_KEY";
pub const ERR_AUBE_MISSING_STORE_FILE: &str = "ERR_AUBE_MISSING_STORE_FILE";

// ── scripts ─────────────────────────────────────────────────────────
pub const ERR_AUBE_SCRIPT_SPAWN: &str = "ERR_AUBE_SCRIPT_SPAWN";
pub const ERR_AUBE_SCRIPT_NON_ZERO_EXIT: &str = "ERR_AUBE_SCRIPT_NON_ZERO_EXIT";
#[rustfmt::skip] pub const ERR_AUBE_BUILD_POLICY_UNSUPPORTED_VALUE: &str = "ERR_AUBE_BUILD_POLICY_UNSUPPORTED_VALUE";
#[rustfmt::skip] pub const ERR_AUBE_BUILD_POLICY_INVALID_VERSION_UNION: &str = "ERR_AUBE_BUILD_POLICY_INVALID_VERSION_UNION";
#[rustfmt::skip] pub const ERR_AUBE_BUILD_POLICY_WILDCARD_WITH_VERSION: &str = "ERR_AUBE_BUILD_POLICY_WILDCARD_WITH_VERSION";

// ── workspace / filter ──────────────────────────────────────────────
pub const ERR_AUBE_WORKSPACE_PARSE: &str = "ERR_AUBE_WORKSPACE_PARSE";
pub const ERR_AUBE_FILTER_EMPTY: &str = "ERR_AUBE_FILTER_EMPTY";
pub const ERR_AUBE_FILTER_GIT_IO: &str = "ERR_AUBE_FILTER_GIT_IO";
pub const ERR_AUBE_FILTER_GIT_FAILED: &str = "ERR_AUBE_FILTER_GIT_FAILED";

// ── manifest ────────────────────────────────────────────────────────
pub const ERR_AUBE_MANIFEST_PARSE: &str = "ERR_AUBE_MANIFEST_PARSE";
pub const ERR_AUBE_MANIFEST_YAML_PARSE: &str = "ERR_AUBE_MANIFEST_YAML_PARSE";

// ── engine / cli ────────────────────────────────────────────────────
pub const ERR_AUBE_UNSUPPORTED_ENGINE: &str = "ERR_AUBE_UNSUPPORTED_ENGINE";
pub const ERR_AUBE_RECURSIVE_NOT_SUPPORTED: &str = "ERR_AUBE_RECURSIVE_NOT_SUPPORTED";
pub const ERR_AUBE_UNKNOWN_COMMAND: &str = "ERR_AUBE_UNKNOWN_COMMAND";
pub const ERR_AUBE_NPM_ONLY_COMMAND: &str = "ERR_AUBE_NPM_ONLY_COMMAND";
pub const ERR_AUBE_COMPLETION_FAILED: &str = "ERR_AUBE_COMPLETION_FAILED";
pub const ERR_AUBE_REMOVE_PRIOR_INSTALL_DIR: &str = "ERR_AUBE_REMOVE_PRIOR_INSTALL_DIR";

// ── misc tracing::error! sites (non-fatal but high-severity) ────────
pub const ERR_AUBE_PATCHES_TRACKING_WRITE: &str = "ERR_AUBE_PATCHES_TRACKING_WRITE";
pub const ERR_AUBE_UNSAFE_SHEBANG_INTERPRETER: &str = "ERR_AUBE_UNSAFE_SHEBANG_INTERPRETER";

/// Stable category labels that group codes in the generated docs and
/// in `EXIT_TABLE`'s 10-wide allocation ranges. Public so the docs
/// generator can iterate them in a deterministic order.
pub mod category {
    pub const LOCKFILE: &str = "Lockfile";
    pub const RESOLVER: &str = "Resolver";
    pub const TARBALL_STORE: &str = "Tarball / store";
    pub const REGISTRY_NETWORK: &str = "Registry / network";
    pub const SCRIPTS: &str = "Scripts / build";
    pub const LINKER: &str = "Linker";
    pub const MANIFEST_WORKSPACE: &str = "Manifest / workspace";
    pub const ENGINE_CLI: &str = "Engine / CLI";
    pub const MISC_SAFETY: &str = "Misc / safety";
}

/// Registry of every error code with its category, description, and
/// (optional) bespoke exit code. Walked by the
/// `generate-error-codes-docs` binary and by the self-tests in
/// `lib.rs` and `exit.rs`. New codes must be added here.
pub const ALL: &[CodeMeta] = &[
    // Lockfile
    CodeMeta {
        name: ERR_AUBE_NO_LOCKFILE,
        category: category::LOCKFILE,
        description: "An operation that required a lockfile (`--frozen-lockfile`, `aube fetch`, etc.) found none in the project.",
        exit_code: Some(10),
    },
    CodeMeta {
        name: ERR_AUBE_LOCKFILE_PARSE,
        category: category::LOCKFILE,
        description: "Lockfile is structurally invalid — version guard failed, YAML shape is wrong, or `yaml_serde` couldn't round-trip the contents.",
        exit_code: Some(11),
    },
    CodeMeta {
        name: ERR_AUBE_LOCKFILE_UNSUPPORTED_FORMAT,
        category: category::LOCKFILE,
        description: "Lockfile filename was recognized but its format isn't supported on this aube version.",
        exit_code: Some(12),
    },
    // Resolver
    CodeMeta {
        name: ERR_AUBE_NO_MATCHING_VERSION,
        category: category::RESOLVER,
        description: "No published version of the named package satisfies the requested range.",
        exit_code: Some(20),
    },
    CodeMeta {
        name: ERR_AUBE_NO_MATURE_MATCHING_VERSION,
        category: category::RESOLVER,
        description: "A version satisfying the range exists but every candidate was younger than `minimumReleaseAge` and `minimumReleaseAgeStrict=true`.",
        exit_code: Some(21),
    },
    CodeMeta {
        name: ERR_AUBE_BLOCKED_EXOTIC_SUBDEP,
        category: category::RESOLVER,
        description: "Transitive dep used a `git:` / `file:` / `tarball` specifier and `blockExoticSubdeps=true`.",
        exit_code: Some(22),
    },
    CodeMeta {
        name: ERR_AUBE_TRUST_DOWNGRADE,
        category: category::RESOLVER,
        description: "Picked version dropped trust evidence the prior version had (`trustPolicy=no-downgrade`).",
        exit_code: Some(23),
    },
    CodeMeta {
        name: ERR_AUBE_TRUST_MISSING_TIME,
        category: category::RESOLVER,
        description: "Registry's packument has no `time` entry for the picked version (`trustPolicy=no-downgrade`).",
        exit_code: Some(24),
    },
    CodeMeta {
        name: ERR_AUBE_UNKNOWN_CATALOG,
        category: category::RESOLVER,
        description: "A `catalog:<name>` reference was used but the catalog isn't defined.",
        exit_code: Some(25),
    },
    CodeMeta {
        name: ERR_AUBE_UNKNOWN_CATALOG_ENTRY,
        category: category::RESOLVER,
        description: "The catalog exists but has no entry for the requested package.",
        exit_code: Some(26),
    },
    CodeMeta {
        name: ERR_AUBE_PEER_CONTEXT_NOT_CONVERGED,
        category: category::RESOLVER,
        description: "Peer-context fixed-point loop hit `MAX_ITERATIONS=16` without converging — usually mutually-recursive peers.",
        exit_code: Some(27),
    },
    CodeMeta {
        name: ERR_AUBE_REGISTRY_ERROR,
        category: category::RESOLVER,
        description: "Generic registry error from inside the resolver.",
        exit_code: None,
    },
    CodeMeta {
        name: ERR_AUBE_TRUST_EXCLUDE_INVALID_VERSION_UNION,
        category: category::RESOLVER,
        description: "A `trustPolicyExclude` pattern had a non-exact version.",
        exit_code: None,
    },
    CodeMeta {
        name: ERR_AUBE_TRUST_EXCLUDE_NAME_GLOB_WITH_VERSIONS,
        category: category::RESOLVER,
        description: "A `trustPolicyExclude` pattern combined a name glob with versions.",
        exit_code: None,
    },
    // Tarball / store
    CodeMeta {
        name: ERR_AUBE_TARBALL_INTEGRITY,
        category: category::TARBALL_STORE,
        description: "Downloaded tarball's hash didn't match the lockfile's / packument's `dist.integrity`.",
        exit_code: Some(30),
    },
    CodeMeta {
        name: ERR_AUBE_TARBALL_EXTRACT,
        category: category::TARBALL_STORE,
        description: "Tarball couldn't be extracted (corrupt gzip, unexpected entry shape, etc.).",
        exit_code: Some(31),
    },
    CodeMeta {
        name: ERR_AUBE_PKG_CONTENT_MISMATCH,
        category: category::TARBALL_STORE,
        description: "Tarball's `package.json` declared a different `(name, version)` than the resolver expected (`strictStorePkgContentCheck=true`).",
        exit_code: Some(32),
    },
    CodeMeta {
        name: ERR_AUBE_GIT_ERROR,
        category: category::TARBALL_STORE,
        description: "Git operation failed during a `git:` dep prepare or checkout.",
        exit_code: Some(33),
    },
    CodeMeta {
        name: ERR_AUBE_NO_HOME,
        category: category::TARBALL_STORE,
        description: "`HOME` (or platform equivalent) is unset, so aube can't locate its store.",
        exit_code: None,
    },
    // Registry / network
    CodeMeta {
        name: ERR_AUBE_PACKAGE_NOT_FOUND,
        category: category::REGISTRY_NETWORK,
        description: "Registry returned 404 for the package name.",
        exit_code: Some(40),
    },
    CodeMeta {
        name: ERR_AUBE_VERSION_NOT_FOUND,
        category: category::REGISTRY_NETWORK,
        description: "Package exists but the requested version doesn't.",
        exit_code: Some(41),
    },
    CodeMeta {
        name: ERR_AUBE_UNAUTHORIZED,
        category: category::REGISTRY_NETWORK,
        description: "Registry returned 401/403 — missing or invalid auth. Run `aube login`.",
        exit_code: Some(42),
    },
    CodeMeta {
        name: ERR_AUBE_OFFLINE,
        category: category::REGISTRY_NETWORK,
        description: "Offline mode and the requested resource isn't in the local cache.",
        exit_code: Some(43),
    },
    CodeMeta {
        name: ERR_AUBE_INVALID_PACKAGE_NAME,
        category: category::REGISTRY_NETWORK,
        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.",
        exit_code: Some(44),
    },
    CodeMeta {
        name: ERR_AUBE_REGISTRY_WRITE_REJECTED,
        category: category::REGISTRY_NETWORK,
        description: "Registry rejected a publish/deprecate/owner write with a non-2xx response.",
        exit_code: Some(45),
    },
    // Scripts / build
    CodeMeta {
        name: ERR_AUBE_SCRIPT_NON_ZERO_EXIT,
        category: category::SCRIPTS,
        description: "A lifecycle script (`preinstall` / `install` / `postinstall` / a `package.json` script) exited non-zero.",
        exit_code: Some(50),
    },
    CodeMeta {
        name: ERR_AUBE_SCRIPT_SPAWN,
        category: category::SCRIPTS,
        description: "Couldn't spawn a script's interpreter (shell missing, jail setup failed, etc.).",
        exit_code: Some(51),
    },
    CodeMeta {
        name: ERR_AUBE_BUILD_POLICY_UNSUPPORTED_VALUE,
        category: category::SCRIPTS,
        description: "An entry in `allowBuilds` had a value that wasn't `true`/`false`.",
        exit_code: None,
    },
    CodeMeta {
        name: ERR_AUBE_BUILD_POLICY_INVALID_VERSION_UNION,
        category: category::SCRIPTS,
        description: "An `allowBuilds` pattern's version union was unparseable.",
        exit_code: None,
    },
    CodeMeta {
        name: ERR_AUBE_BUILD_POLICY_WILDCARD_WITH_VERSION,
        category: category::SCRIPTS,
        description: "An `allowBuilds` pattern combined a wildcard name with a version union.",
        exit_code: None,
    },
    // Linker
    CodeMeta {
        name: ERR_AUBE_PATCH_FAILED,
        category: category::LINKER,
        description: "Applying a `pnpm.patchedDependencies` patch failed.",
        exit_code: Some(60),
    },
    CodeMeta {
        name: ERR_AUBE_LINK_FAILED,
        category: category::LINKER,
        description: "Symlink / junction / hardlink couldn't be created — usually permissions or filesystem support.",
        exit_code: Some(61),
    },
    CodeMeta {
        name: ERR_AUBE_MISSING_PACKAGE_INDEX,
        category: category::LINKER,
        description: "Internal: a caller skipped `load_index` but the package wasn't already materialized.",
        exit_code: Some(62),
    },
    CodeMeta {
        name: ERR_AUBE_MISSING_STORE_FILE,
        category: category::LINKER,
        description: "A package index references a CAS shard that doesn't exist on disk. Re-run install to re-fetch.",
        exit_code: Some(63),
    },
    // Manifest / workspace
    CodeMeta {
        name: ERR_AUBE_MANIFEST_PARSE,
        category: category::MANIFEST_WORKSPACE,
        description: "A `package.json` had a syntax error. miette renders a pointer at the offending byte.",
        exit_code: Some(70),
    },
    CodeMeta {
        name: ERR_AUBE_WORKSPACE_PARSE,
        category: category::MANIFEST_WORKSPACE,
        description: "An `aube-workspace.yaml` / `pnpm-workspace.yaml` was structurally invalid.",
        exit_code: Some(71),
    },
    CodeMeta {
        name: ERR_AUBE_MANIFEST_YAML_PARSE,
        category: category::MANIFEST_WORKSPACE,
        description: "A workspace YAML helper file was structurally invalid (no source pointer available).",
        exit_code: None,
    },
    CodeMeta {
        name: ERR_AUBE_FILTER_EMPTY,
        category: category::MANIFEST_WORKSPACE,
        description: "`--filter` was passed an empty selector.",
        exit_code: None,
    },
    CodeMeta {
        name: ERR_AUBE_FILTER_GIT_IO,
        category: category::MANIFEST_WORKSPACE,
        description: "A `--filter ...[ref]` selector failed to spawn `git`.",
        exit_code: None,
    },
    CodeMeta {
        name: ERR_AUBE_FILTER_GIT_FAILED,
        category: category::MANIFEST_WORKSPACE,
        description: "The git subprocess for a `--filter ...[ref]` selector exited non-zero.",
        exit_code: None,
    },
    // Engine / CLI
    CodeMeta {
        name: ERR_AUBE_UNSUPPORTED_ENGINE,
        category: category::ENGINE_CLI,
        description: "One or more packages declared an `engines` constraint incompatible with the running Node/aube and `engine-strict=true`.",
        exit_code: Some(80),
    },
    CodeMeta {
        name: ERR_AUBE_UNKNOWN_COMMAND,
        category: category::ENGINE_CLI,
        description: "The named subcommand isn't a built-in aube command and isn't a script in the manifest.",
        exit_code: Some(81),
    },
    CodeMeta {
        name: ERR_AUBE_NPM_ONLY_COMMAND,
        category: category::ENGINE_CLI,
        description: "The user invoked an npm-only command (`whoami`, `token`, `owner`, `search`, `pkg`, `set-script`) — aube doesn't implement these; use npm.",
        exit_code: Some(82),
    },
    CodeMeta {
        name: ERR_AUBE_RECURSIVE_NOT_SUPPORTED,
        category: category::ENGINE_CLI,
        description: "A command was invoked under `--recursive` but doesn't support recursive execution.",
        exit_code: None,
    },
    CodeMeta {
        name: ERR_AUBE_COMPLETION_FAILED,
        category: category::ENGINE_CLI,
        description: "`aube completion` couldn't invoke `usage` to render the shell completions.",
        exit_code: None,
    },
    CodeMeta {
        name: ERR_AUBE_REMOVE_PRIOR_INSTALL_DIR,
        category: category::ENGINE_CLI,
        description: "Couldn't clean up a prior global install dir before re-installing.",
        exit_code: None,
    },
    // Misc / safety
    CodeMeta {
        name: ERR_AUBE_UNSAFE_INDEX_KEY,
        category: category::MISC_SAFETY,
        description: "A package index key tried to escape its directory (path traversal defense in depth).",
        exit_code: Some(90),
    },
    CodeMeta {
        name: ERR_AUBE_UNSAFE_SHEBANG_INTERPRETER,
        category: category::MISC_SAFETY,
        description: "A `#!` shebang named an unsafe interpreter when generating a shim — substituted with `node` instead. Surfaced as `tracing::error!` but install continues.",
        exit_code: Some(91),
    },
    CodeMeta {
        name: ERR_AUBE_PATCHES_TRACKING_WRITE,
        category: category::MISC_SAFETY,
        description: "Couldn't write `.aube-applied-patches.json` after applying patches. Non-fatal; next install may miss stale patched entries.",
        exit_code: None,
    },
];