JuliusBrussee/caveman · error

unknown import option

Error message

unknown import option ${flag}

What it means

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.

Solutions

  1. Use only --out, --dry-run, or --json; run the command with --help to see accepted options.
  2. Fix typos: --dryrun → --dry-run, --output → --out.
  3. Remove the unsupported flag and rely on defaults.

Example fix

// before
$ cave skill import ./skill --force
Error: unknown import option --force

// after
$ cave skill import ./skill --dry-run
Defensive patterns

Strategy: validation

Validate before calling

const allowed = new Set(['--out', '--dry-run', '--json']);
const flags = args.filter(a => a.startsWith('--'));
const bad = flags.filter(f => !allowed.has(f.split('=')[0]));
if (bad.length) console.error(`unsupported flags: ${bad.join(' ')}; allowed: ${[...allowed].join(', ')}`);

Try / catch

try {
  importSkill(rest);
} catch (error) {
  if (error.message.startsWith('unknown import option')) {
    console.error(`${error.message}\nRun 'cave skill import --help' for valid options.`);
  } else throw error;
}

Prevention

When it happens

Trigger: Running the skill import command with an unrecognized flag such as --force, --output, --out=/path misspelled as --output=..., or a typo like --dryrun.

Common situations: Muscle-memory flags from other CLI tools (--force); guessing flag names instead of checking help; passing --verbose which this subcommand doesn't support.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/27d093678d655287. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/index.ts:1664

		entry_condition: entry ? { status: "inferred_needs_review", value: entry.slice(0, 240) } : { status: "missing" },
		stop_condition: stop ? { status: "inferred_needs_review", value: stop.slice(0, 240) } : { status: "missing" },
		prompt: { bytes, byte_budget: byteBudget, status: bytes <= 8192 ? "bounded_draft" : "needs_deferred_split" },
		resources,
		transformations: { exact_duplicate_blocks_removed: transformations.removedDuplicates, decorative_separators_removed: transformations.removedSeparators },
		conflicts: { status: "needs_review", declared: [] },
		benchmarks: { status: "required", fixtures: [] },
		evidence_status: "unevaluated",
		publication: { status: "blocked", blockers },
	};
}

function importSkill(rest: string[]) {
	const allowed = new Set(["--out", "--dry-run", "--json"]);
	for (let index = 1; index < rest.length; index++) {
		const value = rest[index]!;
		if (!value.startsWith("--")) continue;
		const flag = value.split("=", 1)[0]!;
		if (!allowed.has(flag)) throw new Error(`unknown import option ${flag}`);
		if (flag === "--out" && !value.includes("=")) index++;
	}
	const input = positionalAfterOptions(rest.slice(1), new Set(["--out"]));
	if (!input) return skillsUsage();
	let source: { root: string; file: string };
	try { source = importedSkillSource(input); } catch (error) {
		console.error(`caveman skills import: ${(error as Error).message}`);
		process.exit(2);
	}
	const sourceBytes = readFileSync(source.file);
	let transformed: ReturnType<typeof cavemannifyImportedSkill>;
	try { transformed = cavemannifyImportedSkill(sourceBytes); } catch (error) {
		console.error(`caveman skills import: ${(error as Error).message}`);
		process.exit(2);
	}
	const name = transformed.body.match(/^name:\s*["']?([a-z0-9-]+)["']?\s*$/m)?.[1];
	if (!name || name.length > 63) {
		console.error("caveman skills import: frontmatter name must be lowercase hyphen-case under 64 characters");

View on GitHub (pinned to 3ee70a1026)