pbakaus/impeccable · error

comp-spec: no region {id}

Error message

comp-spec: no region {id}

What it means

With a successfully loaded spec, `comp-spec --plate-prompt <id>` searches spec.regions for a region whose id matches. If no region has that id, it reports the unknown id and exits 1. The spec exists; the requested region identifier does not.

Source

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

        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;
    }
    if let Some(id) = arg(argv, "crop") {
        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))).cloned();
        let Some(region) = region else {
            let ids = spec.get("regions").and_then(Value::as_array).map(|a| a.iter().filter_map(|r| r.get("id").and_then(Value::as_str)).collect::<Vec<_>>().join(", ")).unwrap_or_default();
            io.err(&format!("comp-spec: no region {id}; ids: {ids}\n"));
            return 1;
        };
        let comp_file = spec.get("comp").and_then(Value::as_str).unwrap_or("");
        let comp = match png_io::load_raster(&resolve(io, comp_file)) {

View on GitHub (pinned to 2bc2879276)

Solutions

  1. Run `comp-spec --print` to list the region ids actually in the current spec.
  2. Correct the id spelling/case to match an existing region.
  3. If the region is new, update regions.json and regenerate: `comp-spec --comp <png> --regions <json>`.
  4. Regenerate the spec if regions.json changed but spec.json did not.

Example fix

// before
$ impeccable comp-spec --plate-prompt Art
comp-spec: no region Art
// after
$ impeccable comp-spec --plate-prompt art   // id matches regions.json
Defensive patterns

Strategy: validation

When it happens

Trigger: `--plate-prompt <id>` (or similarly --crop <id>) with an id string that is not present in the spec's regions array — typo, case mismatch, or a region defined in the regions JSON but dropped during measurement.

Common situations: Region ids renamed in regions.json after the spec was generated (stale spec); typos like 'Art' vs 'art'; asking for a region from a different project's spec.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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