pbakaus/impeccable · error

comp-spec: no region

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.

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@f2c7051853 (2026-09-16). Data as JSON: /api/errors/ef175f00a23f4e0e. Report an issue: GitHub.

Appendix: source

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

            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 background = arg(argv, "background");
        if flag(argv, "background") && !matches!(background, Some("transparent" | "opaque" | "auto")) {
            io.err("comp-spec: --background must be transparent, opaque, or auto.\n");
            return 1;
        }
        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_background(&spec, region, background == Some("transparent"))));
        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 f2c7051853)