{"record":{"id":"0393d79c6399cc4b","repo":"pbakaus/impeccable","slug":"comp-spec-pass-grid-to-get-the-coordinate-grid","errorCode":null,"errorMessage":"comp-spec: pass --grid to get the coordinate grid, then --regions <json> (or --auto for band regions)\n","messagePattern":"comp-spec: pass --grid to get the coordinate grid, then --regions <json> \\(or --auto for band regions\\)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/comp-verbs/src/comp_spec.rs","lineNumber":937,"sourceCode":"\n    let regions_input: Value = if let Some(rf) = arg(argv, \"regions\") {\n        match std::fs::read_to_string(resolve(io, rf)) {\n            Ok(raw) => match serde_json::from_str(&raw) {\n                Ok(v) => v,\n                Err(e) => {\n                    io.err(&format!(\"comp-spec: cannot read regions {rf}: {e}\\n\"));\n                    return 1;\n                }\n            },\n            Err(e) => {\n                io.err(&format!(\"comp-spec: cannot read regions {rf}: {e}\\n\"));\n                return 1;\n            }\n        }\n    } else if flag(argv, \"auto\") {\n        auto_regions(&comp)\n    } else {\n        io.err(\"comp-spec: pass --grid to get the coordinate grid, then --regions <json> (or --auto for band regions)\\n\");\n        return 1;\n    };\n    let spec = match measure_regions(&comp, &regions_input, comp_path) {\n        Ok(s) => s,\n        Err(e) => {\n            io.err(&format!(\"comp-spec: {e}\\n\"));\n            return 1;\n        }\n    };\n    let spec_out = resolve(io, &spec_path);\n    if let Some(parent) = spec_out.parent() {\n        let _ = std::fs::create_dir_all(parent);\n    }\n    let _ = std::fs::write(&spec_out, util::json_pretty(&spec));\n    io.out(&format!(\"WROTE {spec_path}\\n\"));\n    io.out(&format!(\"{}\\n\", print_spec(&spec)));\n    let _ = r4f(0.0); // silence unused if optimized away\n    0","sourceCodeStart":919,"sourceCodeEnd":955,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/comp-verbs/src/comp_spec.rs#L919-L955","documentation":"After loading the comp image, comp-spec needs a region source: a --regions JSON file, --auto band regions, or --grid to render the coordinate grid first. This guidance error is printed when none of these mode flags is present, exiting 1.","triggerScenarios":"Calling `comp-spec --comp <png>` (with --spec or nothing else) without any of --grid, --regions <json>, or --auto — e.g. passing only an unknown/misspelled flag like --region or --grids.","commonSituations":"Misspelling --regions as --region so the flag parser drops it; intending to re-measure but only passing --spec; composing scripted invocations where the mode flag variable is empty.","solutions":["Add one of the required mode flags: --grid, --regions <json>, or --auto.","Check flag spelling — `--region`/`--regions-file` are not recognized; only exact `--regions` counts.","If unsure of the workflow, run --grid first and follow the NEXT instructions it prints, then supply regions.json."],"exampleFix":"// before\ncomp-spec --comp comp.png --region regions.json   // misspelled flag\n// after\ncomp-spec --comp comp.png --regions regions.json","handlingStrategy":"validation","validationCode":"const args = ['comp-spec', '--comp', comp, ...rest];\nconst hasMode = args.includes('--grid') || args.includes('--auto') || args.includes('--regions');\nif (!hasMode) {\n  throw new Error('comp-spec needs one of: --grid, --regions <json>, --auto');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Spell mode flags exactly: --grid, --regions, --auto (no abbreviations or aliases).","Build wrappers that construct the mode flag from a single variable so it cannot silently be empty.","Follow the documented workflow: --grid first, then --regions (or --auto).","Log the final argv before spawning to catch dropped flags."],"tags":["cli","missing-flag","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"}