{"record":{"id":"cfa5218ca22e948d","repo":"pbakaus/impeccable","slug":"usage-comp-spec-mjs-comp-png-grid-regi","errorCode":null,"errorMessage":"usage: comp-spec.mjs --comp <png> (--grid | --regions <json> | --auto) [--spec out.json]\n       comp-spec.mjs --print | --crop <id> [--out file] [--scale n] | --plate-prompt <id>\n","messagePattern":"usage: comp-spec\\.mjs --comp <png> \\(--grid \\| --regions <json> \\| --auto\\) \\[--spec out\\.json\\]\n       comp-spec\\.mjs --print \\| --crop <id> \\[--out file\\] \\[--scale n\\] \\| --plate-prompt <id>\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/comp-verbs/src/comp_spec.rs","lineNumber":872,"sourceCode":"            let _ = std::fs::create_dir_all(parent);\n        }\n        let text = vec![(\"impeccable:crop-of\".to_string(), format!(\"{comp_file}#{id}\"))];\n        match png_io::encode_png(&c, &text) {\n            Ok(bytes) => {\n                let _ = std::fs::write(&out_path, bytes);\n            }\n            Err(e) => {\n                io.err(&format!(\"comp-spec: {e}\\n\"));\n                return 1;\n            }\n        }\n        io.out(&format!(\"CROP {out} ({}x{}) region {id} of {comp_file}. Reference only: regenerate the plate from it, never ship it.\\n\", c.width, c.height));\n        return 0;\n    }\n\n    let comp_path = arg(argv, \"comp\");\n    let Some(comp_path) = comp_path else {\n        io.err(\"usage: comp-spec.mjs --comp <png> (--grid | --regions <json> | --auto) [--spec out.json]\\n       comp-spec.mjs --print | --crop <id> [--out file] [--scale n] | --plate-prompt <id>\\n\");\n        return 1;\n    };\n    let comp = match png_io::load_raster(&resolve(io, comp_path)) {\n        Ok((d, _)) => d.image,\n        Err(e) => {\n            io.err(&format!(\"comp-spec: cannot read {comp_path}: {e}\\n\"));\n            return 1;\n        }\n    };\n\n    if flag(argv, \"grid\") {\n        let grid_out = resolve(io, GRID_PATH);\n        if let Some(parent) = grid_out.parent() {\n            let _ = std::fs::create_dir_all(parent);\n        }\n        match png_io::encode_png(&render_grid(&comp), &[]) {\n            Ok(bytes) => {\n                let _ = std::fs::write(&grid_out, bytes);","sourceCodeStart":854,"sourceCodeEnd":890,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/comp-verbs/src/comp_spec.rs#L854-L890","documentation":"If none of the early modes (--help/--print/--plate-prompt/--crop) matched, comp-spec requires the --comp <png> flag to enter its measure modes (--grid/--regions/--auto). This usage message is printed and the command exits 1 when --comp is absent.","triggerScenarios":"Calling `comp-spec` with only --grid, --regions, or --auto (or with no arguments beyond --spec) so arg(argv, \"comp\") returns None.","commonSituations":"Forgetting --comp when re-running --grid; scripting the command and only passing --regions; confusion between the --crop/--print modes (which don't need --comp) and the measure modes (which do).","solutions":["Add --comp <path-to-png> to the command line.","If you meant to inspect an existing spec, use --print or --crop instead, which do not require --comp.","Run `comp-spec --help` to see the full usage."],"exampleFix":"// before\ncomp-spec --grid\n// after\ncomp-spec --comp comp.png --grid","handlingStrategy":"validation","validationCode":"const args = ['comp-spec', ...modeArgs];\nif (!args.includes('--comp')) {\n  throw new Error('comp-spec measure modes require --comp <png>');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --comp when using --grid/--regions/--auto.","Wrap the command in a script that asserts --comp before spawning.","Use --print/--crop modes (no --comp needed) when you only want to inspect an existing spec.","Check `comp-spec --help` when unsure which mode needs which flags."],"tags":["cli","missing-argument","usage"],"backgroundTag":"missing-required-flag","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"}