yamadashy/repomix · error · RepomixError

--skill-output can only be used with --skill-generate

Error message

--skill-output can only be used with --skill-generate

What it means

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.

Source

Thrown at src/cli/actions/defaultAction.ts:95

};

export const runDefaultAction = async (
  directories: string[],
  cwd: string,
  cliOptions: CliOptions,
  progressCallback?: RepomixProgressCallback,
): Promise<DefaultActionRunnerResult> => {
  logger.trace('Loaded CLI options:', redactOptionsForLog(cliOptions));

  // Build the merged config (migration + file config + CLI options)
  const config = await buildMergedConfig(cwd, cliOptions);

  // Validate conflicting options
  validateConflictingOptions(config);

  // Validate --skill-output and --force require --skill-generate
  if (cliOptions.skillOutput && config.skillGenerate === undefined) {
    throw new RepomixError('--skill-output can only be used with --skill-generate');
  }
  if (cliOptions.force && config.skillGenerate === undefined) {
    throw new RepomixError('--force can only be used with --skill-generate');
  }
  if (cliOptions.skillProjectName !== undefined && config.skillGenerate === undefined) {
    throw new RepomixError('--skill-project-name can only be used with --skill-generate');
  }

  // Validate --skill-output is not empty or whitespace only
  if (cliOptions.skillOutput !== undefined && !cliOptions.skillOutput.trim()) {
    throw new RepomixError('--skill-output path cannot be empty');
  }
  if (cliOptions.skillProjectName !== undefined && !cliOptions.skillProjectName.trim()) {
    throw new RepomixError('--skill-project-name cannot be empty');
  }

  // Validate skill generation options and prompt for location
  if (config.skillGenerate !== undefined) {

View on GitHub (pinned to f465ad9093)

Solutions

  1. Add --skill-generate to the command: `repomix --skill-generate --skill-output ./my-skill`.
  2. If you do not want a skill, remove --skill-output and write output normally (e.g. with -o).
  3. Check the parsed command line (repomix --help) to confirm the exact flag spelling of --skill-generate.

Example fix

// before
repomix --skill-output ./skill-dir
// after
repomix --skill-generate --skill-output ./skill-dir
Defensive patterns

Strategy: validation

Validate before calling

const args = ['--skill-output', './skill'];
if (args.includes('--skill-output') && !args.includes('--skill-generate')) {
  throw new Error('usage: --skill-output requires --skill-generate');
}

Type guard

const hasSkillGenerate = (argv: string[]): boolean => argv.includes('--skill-generate');
const skillOutputAllowed = (argv: string[]): boolean => !argv.includes('--skill-output') || hasSkillGenerate(argv);

Try / catch

try {
  await exec('repomix', args);
} catch (e) {
  if (String(e.stderr).includes('--skill-output can only be used with --skill-generate')) {
    return exec('repomix', [...args, '--skill-generate']);
  }
  throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/be4b99dc4e12e36e. Report an issue: GitHub.