{"record":{"id":"be4b99dc4e12e36e","repo":"yamadashy/repomix","slug":"skill-output-can-only-be-used-with-skill-gener","errorCode":null,"errorMessage":"--skill-output can only be used with --skill-generate","messagePattern":"--skill-output can only be used with --skill-generate","errorType":"exception","errorClass":"RepomixError","httpStatus":null,"severity":"error","filePath":"src/cli/actions/defaultAction.ts","lineNumber":95,"sourceCode":"};\n\nexport const runDefaultAction = async (\n  directories: string[],\n  cwd: string,\n  cliOptions: CliOptions,\n  progressCallback?: RepomixProgressCallback,\n): Promise<DefaultActionRunnerResult> => {\n  logger.trace('Loaded CLI options:', redactOptionsForLog(cliOptions));\n\n  // Build the merged config (migration + file config + CLI options)\n  const config = await buildMergedConfig(cwd, cliOptions);\n\n  // Validate conflicting options\n  validateConflictingOptions(config);\n\n  // Validate --skill-output and --force require --skill-generate\n  if (cliOptions.skillOutput && config.skillGenerate === undefined) {\n    throw new RepomixError('--skill-output can only be used with --skill-generate');\n  }\n  if (cliOptions.force && config.skillGenerate === undefined) {\n    throw new RepomixError('--force can only be used with --skill-generate');\n  }\n  if (cliOptions.skillProjectName !== undefined && config.skillGenerate === undefined) {\n    throw new RepomixError('--skill-project-name can only be used with --skill-generate');\n  }\n\n  // Validate --skill-output is not empty or whitespace only\n  if (cliOptions.skillOutput !== undefined && !cliOptions.skillOutput.trim()) {\n    throw new RepomixError('--skill-output path cannot be empty');\n  }\n  if (cliOptions.skillProjectName !== undefined && !cliOptions.skillProjectName.trim()) {\n    throw new RepomixError('--skill-project-name cannot be empty');\n  }\n\n  // Validate skill generation options and prompt for location\n  if (config.skillGenerate !== undefined) {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/cli/actions/defaultAction.ts#L77-L113","documentation":"Repomix's runDefaultAction throws this because --skill-output only makes sense when skill generation is actually requested via --skill-generate. The CLI treats skill-related flags as a closed option group: passing --skill-output alone is ambiguous about whether the user wanted a skill, so it is rejected early in runDefaultAction before any packing work starts. This is a usage (argv) validation error, not a runtime failure.","triggerScenarios":"Running `repomix --skill-output <path>` (with any other flags) while omitting --skill-generate; also produced when skillOutput is truthy in CliOptions but config.skillGenerate remains undefined after option merging in runDefaultAction (src/cli/actions/defaultAction.ts:95).","commonSituations":"Copy-pasting an old or half-remembered command line; shell scripts or aliases that add --skill-output unconditionally; switching from a workflow where --skill-generate was present and accidentally dropping it; mistyping --skill-generate so the flag is not parsed.","solutions":["Add --skill-generate to the command: `repomix --skill-generate --skill-output ./my-skill`.","If you do not want a skill, remove --skill-output and write output normally (e.g. with -o).","Check the parsed command line (repomix --help) to confirm the exact flag spelling of --skill-generate."],"exampleFix":"// before\nrepomix --skill-output ./skill-dir\n// after\nrepomix --skill-generate --skill-output ./skill-dir","handlingStrategy":"validation","validationCode":"const args = ['--skill-output', './skill'];\nif (args.includes('--skill-output') && !args.includes('--skill-generate')) {\n  throw new Error('usage: --skill-output requires --skill-generate');\n}","typeGuard":"const hasSkillGenerate = (argv: string[]): boolean => argv.includes('--skill-generate');\nconst skillOutputAllowed = (argv: string[]): boolean => !argv.includes('--skill-output') || hasSkillGenerate(argv);","tryCatchPattern":"try {\n  await exec('repomix', args);\n} catch (e) {\n  if (String(e.stderr).includes('--skill-output can only be used with --skill-generate')) {\n    return exec('repomix', [...args, '--skill-generate']);\n  }\n  throw e;\n}","preventionTips":["Always pair --skill-output with --skill-generate in scripts and aliases.","Build command lines from a single canonical template instead of concatenating fragments.","Add a shell preflight that greps the argv for the flag pair before exec."],"tags":["cli","argument-validation","repomix"],"backgroundTag":"incompatible-cli-flags","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}