pbakaus/impeccable · error

comp-spec: no spec at {spec_path}; run with --comp <png> --r

Error message

comp-spec: no spec at {spec_path}; run with --comp <png> --regions <json> first

What it means

`comp-spec --print` loads the previously generated spec from spec_path and prints it compactly. If load_spec returns None (the spec file does not exist or is unreadable), it tells the user no spec exists at that path and to generate one first with `--comp <png> --regions <json>`. Exit code 1.

Source

Thrown at crates/comp-verbs/src/comp_spec.rs:801

    if path.is_absolute() {
        path.to_path_buf()
    } else {
        io.cwd.join(path)
    }
}

// ---- CLI -------------------------------------------------------------------

/// `impeccable comp-spec ...`
pub fn run(argv: &[String], io: &mut Io) -> i32 {
    let spec_path = arg_or(argv, "spec", SPEC_PATH).to_string();
    if flag(argv, "help") || argv.is_empty() {
        io.out("usage: comp-spec.mjs --comp <png> --grid            write .impeccable/build/comp-grid.png (10x10 labeled grid) + palette + bands\n       comp-spec.mjs --comp <png> --regions <json>  measure regions -> .impeccable/build/spec.json\n         regions json: { \"regions\": [ { \"id\": \"art\", \"kind\": \"plate|image|texture|text|control|chrome\", \"grid\": \"E0:J4\", \"note\": \"...\" } ] }\n       comp-spec.mjs --comp <png> --auto            band regions when you have no regions file\n       comp-spec.mjs --print                        the compact spec\n       comp-spec.mjs --crop <id> [--out f] [--scale n]   reference crop of a region (never a shipping asset)\n       comp-spec.mjs --plate-prompt <id>            the regeneration prompt for a raster region\n");
        return 0;
    }
    if flag(argv, "print") {
        let Some(spec) = load_spec(&resolve(io, &spec_path)) else {
            io.err(&format!("comp-spec: no spec at {spec_path}; run with --comp <png> --regions <json> first\n"));
            return 1;
        };
        io.out(&format!("{}\n", print_spec(&spec)));
        return 0;
    }
    if let Some(id) = arg(argv, "plate-prompt") {
        let Some(spec) = load_spec(&resolve(io, &spec_path)) else {
            io.err(&format!("comp-spec: no spec at {spec_path}\n"));
            return 1;
        };
        let region = spec.get("regions").and_then(Value::as_array).and_then(|a| a.iter().find(|r| r.get("id").and_then(Value::as_str) == Some(id)));
        let Some(region) = region else {
            io.err(&format!("comp-spec: no region {id}\n"));
            return 1;
        };
        io.out(&format!("{}\n", plate_prompt(&spec, region)));
        return 0;
    }

View on GitHub (pinned to 2bc2879276)

Solutions

  1. Generate the spec first: `impeccable comp-spec --comp <png> --regions <regions.json>`.
  2. Then run `comp-spec --print` (optionally with the same --spec path used at generation).
  3. Run from the same working directory used when the spec was created, or pass an explicit --spec path.
  4. Check that .impeccable/build/spec.json survived any clean steps.

Example fix

// before
$ impeccable comp-spec --print
comp-spec: no spec at .impeccable/build/spec.json; run with --comp <png> --regions <json> first
// after
$ impeccable comp-spec --comp ./comp.png --regions ./regions.json
$ impeccable comp-spec --print
Defensive patterns

Strategy: validation

When it happens

Trigger: Running `comp-spec --print` (and no other mode flags) before ever running the measuring mode; or with a custom spec path (spec_path set via --spec) where nothing was saved; or after the .impeccable/build directory was cleaned.

Common situations: Fresh clone / clean checkout where .impeccable/build was gitignored away; running --print from a different working directory so the default spec path doesn't resolve; a `clean` step removed build artifacts between measure and print.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of pbakaus/impeccable@2bc2879276 (2026-09-08). Data as JSON: /api/errors/a40893a15a47f56f. Report an issue: GitHub.