yamadashy/repomix · error · RepomixError

--skill-output path cannot be empty

Error message

--skill-output path cannot be empty

What it means

When --skill-output is supplied, its value must be a non-empty, non-whitespace path because it becomes the target directory for the generated skill. runDefaultAction throws this when the flag is present but its trimmed value is an empty string (src/cli/actions/defaultAction.ts:106), typically from `--skill-output=` or `--skill-output " "`.

Source

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

  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) {
    // Resolve skill name: use pre-computed name (from remoteAction) or generate from directory
    cliOptions.skillName ??=
      typeof config.skillGenerate === 'string'
        ? config.skillGenerate
        : generateDefaultSkillName(directories.map((d) => path.resolve(cwd, d)));

    // Determine skill directory
    if (cliOptions.skillOutput && !cliOptions.skillDir) {
      // Non-interactive mode: use provided path directly
      cliOptions.skillDir = await resolveAndPrepareSkillDir(cliOptions.skillOutput, cwd, cliOptions.force ?? false);
    } else if (!cliOptions.skillDir) {

View on GitHub (pinned to f465ad9093)

Solutions

  1. Provide a real directory path: `repomix --skill-generate --skill-output ./skills/my-skill`.
  2. In scripts, guard the flag: only add `--skill-output $DIR` when the variable is non-empty.
  3. Echo the full command line before running to confirm the flag received a value.

Example fix

# before (SKILL_DIR is empty)
repomix --skill-generate --skill-output "$SKILL_DIR"
# after
if [ -n "$SKILL_DIR" ]; then set -- "$@" --skill-output "$SKILL_DIR"; fi
repomix --skill-generate "$@"
Defensive patterns

Strategy: validation

Validate before calling

const i = args.indexOf('--skill-output');
if (i !== -1) {
  const v = args[i + 1] ?? '';
  if (!v.trim()) throw new Error('Provide a non-empty --skill-output directory');
}

Type guard

const hasNonEmptyValue = (args: string[], flag: string): boolean => {
  const v = args[args.indexOf(flag) + 1];
  return typeof v === 'string' && v.trim().length > 0;
};

Try / catch

try {
  await repomixRun(args);
} catch (e) {
  if (String(e.message).includes('--skill-output path cannot be empty')) {
    throw new Error('Set SKILL_OUTPUT to a real directory path before running');
  }
  throw e;
}

Prevention

When it happens

Trigger: Invoking repomix with `--skill-output` followed by an empty string value (e.g. `--skill-output=""` or `--skill-output " "`) together with --skill-generate; scripts interpolating an unset variable into the flag value.

Common situations: Shell scripts using `${SKILL_DIR:+--skill-output $SKILL_DIR}` incorrectly or `${SKILL_DIR:-}` producing an empty value; CI variables not set for the job; quoting mistakes such as `--skill-output ""`.

Related errors


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