{"record":{"id":"8c9979b6e63d022d","repo":"pbakaus/impeccable","slug":"comp-spec-no-spec-at-spec-path","errorCode":null,"errorMessage":"comp-spec: no spec at {spec_path}\n","messagePattern":"comp-spec: no spec at (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/comp-verbs/src/comp_spec.rs","lineNumber":809,"sourceCode":"\n/// `impeccable comp-spec ...`\npub fn run(argv: &[String], io: &mut Io) -> i32 {\n    let spec_path = arg_or(argv, \"spec\", SPEC_PATH).to_string();\n    if flag(argv, \"help\") || argv.is_empty() {\n        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\");\n        return 0;\n    }\n    if flag(argv, \"print\") {\n        let Some(spec) = load_spec(&resolve(io, &spec_path)) else {\n            io.err(&format!(\"comp-spec: no spec at {spec_path}; run with --comp <png> --regions <json> first\\n\"));\n            return 1;\n        };\n        io.out(&format!(\"{}\\n\", print_spec(&spec)));\n        return 0;\n    }\n    if let Some(id) = arg(argv, \"plate-prompt\") {\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)));\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();","sourceCodeStart":791,"sourceCodeEnd":827,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/comp-verbs/src/comp_spec.rs#L791-L827","documentation":"`comp-spec --plate-prompt <id>` first loads the spec (load_spec) before looking up the requested region. If the spec file cannot be loaded, it emits this shorter variant of the missing-spec message (without the how-to-fix hint) and exits 1. This error is about the spec store, not about the region id.","triggerScenarios":"Running `comp-spec --plate-prompt <id>` when no spec exists at spec_path (never generated, deleted, or wrong --spec path / working directory).","commonSituations":"Same as --print: cleaned build dir, wrong cwd, typo'd --spec path; also automation invoking --plate-prompt before the measure step ran in a fresh CI workspace.","solutions":["Generate the spec first with `comp-spec --comp <png> --regions <json>`.","Verify the spec path — pass explicit --spec if not using the default .impeccable/build/spec.json.","Re-run from the correct working directory."],"exampleFix":"// before\n$ impeccable comp-spec --plate-prompt art\ncomp-spec: no spec at .impeccable/build/spec.json\n// after\n$ impeccable comp-spec --comp ./comp.png --regions ./regions.json\n$ impeccable comp-spec --plate-prompt art","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nconst specPath = args.spec ?? '.impeccable/build/spec.json';\nif (!existsSync(specPath)) throw new Error(`spec missing at ${specPath}; generate before --plate-prompt`);","typeGuard":null,"tryCatchPattern":"const r = spawnSync('impeccable', ['comp-spec', '--plate-prompt', id]);\nif (r.status === 1 && /no spec at/.test(r.stderr.toString())) {\n  runSync('impeccable', ['comp-spec', '--comp', comp, '--regions', regions]);\n  // then retry the plate-prompt call\n}","preventionTips":["Run comp-spec measure mode before any --plate-prompt usage.","In CI, restore or regenerate the spec at job start.","Pass an explicit --spec path when operating outside the default build dir."],"tags":["cli","spec","missing-file","workflow-order"],"backgroundTag":"file-not-found","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}