{"record":{"id":"c0b6b68d8261344b","repo":"yamadashy/repomix","slug":"skill-output-path-cannot-be-empty","errorCode":null,"errorMessage":"--skill-output path cannot be empty","messagePattern":"--skill-output path cannot be empty","errorType":"exception","errorClass":"RepomixError","httpStatus":null,"severity":"error","filePath":"src/cli/actions/defaultAction.ts","lineNumber":106,"sourceCode":"  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) {\n    // Resolve skill name: use pre-computed name (from remoteAction) or generate from directory\n    cliOptions.skillName ??=\n      typeof config.skillGenerate === 'string'\n        ? config.skillGenerate\n        : generateDefaultSkillName(directories.map((d) => path.resolve(cwd, d)));\n\n    // Determine skill directory\n    if (cliOptions.skillOutput && !cliOptions.skillDir) {\n      // Non-interactive mode: use provided path directly\n      cliOptions.skillDir = await resolveAndPrepareSkillDir(cliOptions.skillOutput, cwd, cliOptions.force ?? false);\n    } else if (!cliOptions.skillDir) {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/cli/actions/defaultAction.ts#L88-L124","documentation":"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 \" \"`.","triggerScenarios":"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.","commonSituations":"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 \"\"`.","solutions":["Provide a real directory path: `repomix --skill-generate --skill-output ./skills/my-skill`.","In scripts, guard the flag: only add `--skill-output $DIR` when the variable is non-empty.","Echo the full command line before running to confirm the flag received a value."],"exampleFix":"# before (SKILL_DIR is empty)\nrepomix --skill-generate --skill-output \"$SKILL_DIR\"\n# after\nif [ -n \"$SKILL_DIR\" ]; then set -- \"$@\" --skill-output \"$SKILL_DIR\"; fi\nrepomix --skill-generate \"$@\"","handlingStrategy":"validation","validationCode":"const i = args.indexOf('--skill-output');\nif (i !== -1) {\n  const v = args[i + 1] ?? '';\n  if (!v.trim()) throw new Error('Provide a non-empty --skill-output directory');\n}","typeGuard":"const hasNonEmptyValue = (args: string[], flag: string): boolean => {\n  const v = args[args.indexOf(flag) + 1];\n  return typeof v === 'string' && v.trim().length > 0;\n};","tryCatchPattern":"try {\n  await repomixRun(args);\n} catch (e) {\n  if (String(e.message).includes('--skill-output path cannot be empty')) {\n    throw new Error('Set SKILL_OUTPUT to a real directory path before running');\n  }\n  throw e;\n}","preventionTips":["In shell, expand defaults: --skill-output \"${SKILL_OUTPUT:-./skill}\".","Never interpolate potentially-empty variables directly into flag values.","Quote values and test the assembled command with echo before running."],"tags":["cli","argument-validation","empty-value","repomix"],"backgroundTag":"empty-option-value","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}