{"record":{"id":"b06f73e679852334","repo":"pbakaus/impeccable","slug":"comp-spec-no-region-id-ids-ids","errorCode":null,"errorMessage":"comp-spec: no region {id}; ids: {ids}\n","messagePattern":"comp-spec: no region (.+?); ids: (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/comp-verbs/src/comp_spec.rs","lineNumber":828,"sourceCode":"            return 1;\n        };\n        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)));\n        let Some(region) = region else {\n            io.err(&format!(\"comp-spec: no region {id}\\n\"));\n            return 1;\n        };\n        io.out(&format!(\"{}\\n\", plate_prompt(&spec, region)));\n        return 0;\n    }\n    if let Some(id) = arg(argv, \"crop\") {\n        let Some(spec) = load_spec(&resolve(io, &spec_path)) else {\n            io.err(&format!(\"comp-spec: no spec at {spec_path}\\n\"));\n            return 1;\n        };\n        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();\n        let Some(region) = region else {\n            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();\n            io.err(&format!(\"comp-spec: no region {id}; ids: {ids}\\n\"));\n            return 1;\n        };\n        let comp_file = spec.get(\"comp\").and_then(Value::as_str).unwrap_or(\"\");\n        let comp = match png_io::load_raster(&resolve(io, comp_file)) {\n            Ok((d, _)) => d.image,\n            Err(e) => {\n                io.err(&format!(\"comp-spec: cannot read {comp_file}: {e}\\n\"));\n                return 1;\n            }\n        };\n        let medium = region.get(\"medium\").and_then(Value::as_str).unwrap_or(\"\");\n        let mut c = if medium == \"raster\" && !flag(argv, \"raw\") {\n            plate_reference(&comp, &spec, &region)\n        } else {\n            let px = |k: &str| region.pointer(&format!(\"/px/{k}\")).and_then(Value::as_f64).unwrap_or(0.0);\n            r::crop(&comp, px(\"x\"), px(\"y\"), px(\"w\"), px(\"h\"))\n        };\n        let scale = util::parse_f64(arg_or(argv, \"scale\", \"1\"), 1.0);","sourceCodeStart":810,"sourceCodeEnd":846,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/comp-verbs/src/comp_spec.rs#L810-L846","documentation":"When cropping, comp-spec looks up the region whose \"id\" matches the --crop value in spec.regions. If no region has that id, this error lists all valid region ids so the caller can pick the right one. It guards against typos and stale specs.","triggerScenarios":"`comp-spec --crop <id>` where <id> does not exactly match any region id string in the spec's regions array — including case mismatches, ids from an older spec, or regions renamed in regions.json after the spec was regenerated.","commonSituations":"Typos in the region id; copying an id from an old spec after re-running --regions with new ids; forgetting that ids are case-sensitive; using the --plate-prompt id name space interchangeably when the spec changed.","solutions":["Use one of the ids listed in the error's `ids:` suffix.","Run `comp-spec --print` to see the current spec and its exact region ids.","If the id should exist, re-run `comp-spec --comp <png> --regions regions.json` to refresh the spec, then retry.","Fix the id in your regions.json and regenerate the spec."],"exampleFix":"// before\ncomp-spec --crop Exploded-Plate   // case mismatch, spec has 'exploded-plate'\n// after\ncomp-spec --crop exploded-plate","handlingStrategy":"validation","validationCode":"const spec = JSON.parse(fs.readFileSync(specPath, 'utf8'));\nconst ids = new Set((spec.regions ?? []).map(r => r.id));\nif (!ids.has(cropId)) {\n  throw new Error(`unknown region '${cropId}'; valid ids: ${[...ids].join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy region ids from `comp-spec --print` output instead of typing them from memory.","Keep ids lowercase-kebab-case to avoid case mismatches.","Regenerate region id references whenever regions.json changes.","Check the `ids:` list in the error message first — it enumerates all valid choices."],"tags":["cli","invalid-identifier","lookup-miss"],"backgroundTag":"record-not-found","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}