{"record":{"id":"27d093678d655287","repo":"JuliusBrussee/caveman","slug":"unknown-import-option-flag","errorCode":null,"errorMessage":"unknown import option ${flag}","messagePattern":"unknown import option (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":1664,"sourceCode":"\t\tentry_condition: entry ? { status: \"inferred_needs_review\", value: entry.slice(0, 240) } : { status: \"missing\" },\n\t\tstop_condition: stop ? { status: \"inferred_needs_review\", value: stop.slice(0, 240) } : { status: \"missing\" },\n\t\tprompt: { bytes, byte_budget: byteBudget, status: bytes <= 8192 ? \"bounded_draft\" : \"needs_deferred_split\" },\n\t\tresources,\n\t\ttransformations: { exact_duplicate_blocks_removed: transformations.removedDuplicates, decorative_separators_removed: transformations.removedSeparators },\n\t\tconflicts: { status: \"needs_review\", declared: [] },\n\t\tbenchmarks: { status: \"required\", fixtures: [] },\n\t\tevidence_status: \"unevaluated\",\n\t\tpublication: { status: \"blocked\", blockers },\n\t};\n}\n\nfunction importSkill(rest: string[]) {\n\tconst allowed = new Set([\"--out\", \"--dry-run\", \"--json\"]);\n\tfor (let index = 1; index < rest.length; index++) {\n\t\tconst value = rest[index]!;\n\t\tif (!value.startsWith(\"--\")) continue;\n\t\tconst flag = value.split(\"=\", 1)[0]!;\n\t\tif (!allowed.has(flag)) throw new Error(`unknown import option ${flag}`);\n\t\tif (flag === \"--out\" && !value.includes(\"=\")) index++;\n\t}\n\tconst input = positionalAfterOptions(rest.slice(1), new Set([\"--out\"]));\n\tif (!input) return skillsUsage();\n\tlet source: { root: string; file: string };\n\ttry { source = importedSkillSource(input); } catch (error) {\n\t\tconsole.error(`caveman skills import: ${(error as Error).message}`);\n\t\tprocess.exit(2);\n\t}\n\tconst sourceBytes = readFileSync(source.file);\n\tlet transformed: ReturnType<typeof cavemannifyImportedSkill>;\n\ttry { transformed = cavemannifyImportedSkill(sourceBytes); } catch (error) {\n\t\tconsole.error(`caveman skills import: ${(error as Error).message}`);\n\t\tprocess.exit(2);\n\t}\n\tconst name = transformed.body.match(/^name:\\s*[\"']?([a-z0-9-]+)[\"']?\\s*$/m)?.[1];\n\tif (!name || name.length > 63) {\n\t\tconsole.error(\"caveman skills import: frontmatter name must be lowercase hyphen-case under 64 characters\");","sourceCodeStart":1646,"sourceCodeEnd":1682,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/cli/src/index.ts#L1646-L1682","documentation":"Argument-parsing error in the CLI import command: an unknown flag was passed after --import options. Only the documented set of import flags is accepted; the offending flag name is echoed in the message.","triggerScenarios":"Running the skill import command with an unrecognized flag such as --force, --output, --out=/path misspelled as --output=..., or a typo like --dryrun.","commonSituations":"Muscle-memory flags from other CLI tools (--force); guessing flag names instead of checking help; passing --verbose which this subcommand doesn't support.","solutions":["Use only --out, --dry-run, or --json; run the command with --help to see accepted options.","Fix typos: --dryrun → --dry-run, --output → --out.","Remove the unsupported flag and rely on defaults."],"exampleFix":"// before\n$ cave skill import ./skill --force\nError: unknown import option --force\n\n// after\n$ cave skill import ./skill --dry-run","handlingStrategy":"validation","validationCode":"const allowed = new Set(['--out', '--dry-run', '--json']);\nconst flags = args.filter(a => a.startsWith('--'));\nconst bad = flags.filter(f => !allowed.has(f.split('=')[0]));\nif (bad.length) console.error(`unsupported flags: ${bad.join(' ')}; allowed: ${[...allowed].join(', ')}`);","typeGuard":null,"tryCatchPattern":"try {\n  importSkill(rest);\n} catch (error) {\n  if (error.message.startsWith('unknown import option')) {\n    console.error(`${error.message}\\nRun 'cave skill import --help' for valid options.`);\n  } else throw error;\n}","preventionTips":["Check `cave skill import --help` before using flags new to you","Script against documented flags only; avoid copying flags from other subcommands","Add shell completion for the import subcommand to prevent typos"],"tags":["cli","argument-validation"],"backgroundTag":"invalid-cli-argument","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}