pbakaus/impeccable · error
usage: latest <slug-or-target> [--json]
Error message
usage: latest <slug-or-target> [--json]
What it means
The `latest` subcommand validates its arguments before doing work: it requires a resolvable slug-or-target and, if a second argument is given, it must be exactly `--json`. Anything else prints this usage line to stderr and exits 1.
Source
Thrown at crates/context/src/critique_storage.rs:545
match written {
Some(fp) => {
io.out(&format!("{}\n", fp));
0
}
None => {
io.err(&format!("{}\n", uncaught(&format!("Too many critique snapshots for {} at {}", slug, timestamp))));
1
}
}
}
"latest" => {
let target = rest.first().map(String::as_str).unwrap_or("");
let format = rest.get(1).map(String::as_str);
let slugs = slug_candidates(rest.first().map(String::as_str), &cwd);
// JS: format && format !== '--json' (format truthy = non-empty)
let bad_format = format.map(|f| !f.is_empty() && f != "--json").unwrap_or(false);
if slugs.is_empty() || bad_format {
io.err("usage: latest <slug-or-target> [--json]\n");
return 1;
}
let format_is_json = format == Some("--json");
let target_fingerprint = fingerprint_target(target, &cwd);
let target_path = resolve_local_target_path(target, &cwd);
let target_identity = resolve_target_identity(target, &cwd);
let ready_slug = is_ready_slug(target);
let Some(newest_for_slug) =
read_newest_safe_snapshot_for_slugs(&slugs, target_identity.as_deref(), &cwd, &env)
else {
return 2;
};
let mut latest =
read_newest_snapshot_for_identity_slugs(&slugs, target_identity.as_deref(), &cwd, &env);
if latest.is_none() && !ready_slug {
// Identity-less snapshots are safe only under the new/current
// collision-resistant slug. A pre-hash slug suffix alone cannot
// prove which long target owned the historical snapshot.View on GitHub (pinned to 2bc2879276)
Solutions
- Pass exactly one argument: the slug or a resolvable target path (use an explicit `./path` for local targets).
- If you want JSON, pass the literal flag `--json` as the second argument with nothing after it.
- Verify the slug resolves: `impeccable critique-storage slug <target>` should print a non-empty slug.
- Quote shell variables so an empty arg is not silently dropped or split.
Example fix
// before latest mytarget --JSON // after latest mytarget --json
Defensive patterns
Strategy: validation
Validate before calling
const args = ['latest', target];
if (wantJson) args.push('--json');
const slug = runCapture('impeccable', ['critique-storage', 'slug', target]).stdout.trim();
if (!slug) throw new Error('target does not resolve to a slug'); Prevention
- Always pass the slug/target as the first and only positional argument.
- Use the exact literal `--json` flag when JSON output is needed.
- Resolve the target with the `slug` subcommand before calling latest.
- Quote shell variables to avoid empty or split arguments.
When it happens
Trigger: Running `critique-storage latest` with no argument; with a first argument that yields no slug candidates (empty or unresolvable target); or with a second argument that is not `--json` (e.g. `--JSON`, `-json`, `json`, or an extra stray flag).
Common situations: Typos like `--json=v1` or `latest mytarget --json extra`; running from a directory where the target slug cannot be resolved; scripting the command with a variable that expands to an empty string.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- usage: close <resolved-target> <snapshot-file>
- usage: impeccable critique-storage <slug|write|latest|trend|
- build-phase: record hero --build <png>
- {}
- Unknown action: {}. Use 'pin' or 'unpin'.
AI-assisted analysis of pbakaus/impeccable@2bc2879276 (2026-09-08).
Data as JSON: /api/errors/75f2d376d5a24933.
Report an issue: GitHub.