{"record":{"id":"2a5e204ba2524631","repo":"yamadashy/repomix","slug":"watch-cannot-be-used-with-split-output-watch-mo","errorCode":null,"errorMessage":"--watch cannot be used with split output. Watch mode does not yet support split output files.","messagePattern":"--watch cannot be used with split output\\. Watch mode does not yet support split output files\\.","errorType":"exception","errorClass":"RepomixError","httpStatus":null,"severity":"error","filePath":"src/cli/actions/watchAction.ts","lineNumber":84,"sourceCode":"  if (deps?.signal?.aborted) {\n    return;\n  }\n\n  // Only load chokidar if no watch function is provided (enables faster tests)\n  const resolvedDeps: WatchDeps = deps?.watch ? (deps as WatchDeps) : { ...(await resolveDefaultDeps()), ...deps };\n\n  logger.trace('Watch mode: loaded CLI options:', redactOptionsForLog(cliOptions));\n\n  const config = await buildMergedConfig(cwd, cliOptions);\n\n  // Watch-specific incompatibilities. Each of these is independently incompatible with\n  // --watch and can also be set via the config file (which validateWatchOptions in cliRun,\n  // CLI-flags-only, does not see), so re-check them on the merged config here. They are\n  // checked individually rather than via the shared validateConflictingOptions so the error\n  // always names --watch instead of a (potentially confusing) pairwise conflict.\n  if (config.output.splitOutput !== undefined) {\n    // Split output would create numbered files that the watcher then picks up, looping.\n    throw new RepomixError(\n      '--watch cannot be used with split output. Watch mode does not yet support split output files.',\n    );\n  }\n  // `output: \"-\"` resolves to stdout mode via filePath === '-', the same as --stdout.\n  if (config.output.stdout || config.output.filePath === '-') {\n    throw new RepomixError('--watch cannot be used with stdout output. Watch mode writes to a file.');\n  }\n  if (config.skillGenerate !== undefined) {\n    throw new RepomixError(\n      '--watch cannot be used with --skill-generate. Watch mode does not support skill generation.',\n    );\n  }\n  if (config.output.copyToClipboard) {\n    throw new RepomixError(\n      '--watch cannot be used with --copy. Watch mode re-packs on every change, which would repeatedly overwrite the clipboard.',\n    );\n  }\n","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/cli/actions/watchAction.ts#L66-L102","documentation":"Watch mode packs on every file change; split output would emit numbered part files that the watcher would then pick up as inputs, creating a loop. Repomix therefore rejects `--watch` combined with split output (`output.splitOutput` set via flag or config file) at the start of `runWatchAction`.","triggerScenarios":"Running `repomix --watch --split-output` (or equivalent), or `repomix --watch` when the config file (repomix.config.json) sets `output.split`/`splitOutput` — the config-based value is only visible on the merged config checked here.","commonSituations":"A developer with split output enabled in their config file adds `--watch` to iterate on prompts; CLI-only pre-validation in cliRun doesn't see the config value, so the error surfaces at watch startup.","solutions":["Remove the `--split-output` flag when using `--watch`","Delete or unset the split-output setting from repomix.config.json, or use a separate config for watch runs","Run split-output generation as a one-shot command without `--watch`"],"exampleFix":"// before\nrepomix --watch --split-output\n// after\nrepomix --watch   # single output file\n# or run separately: repomix --split-output (no --watch)","handlingStrategy":"validation","validationCode":"const cfg = JSON.parse(fs.readFileSync('repomix.config.json', 'utf8'));\nif (watch && (process.argv.includes('--split-output') || cfg.output?.split != null)) {\n  throw new Error('Remove split output before using --watch');\n}","typeGuard":"null","tryCatchPattern":"try {\n  await runRepomix({ watch: true });\n} catch (e) {\n  if (e instanceof RepomixError && e.message.includes('--watch cannot be used with split output')) {\n    console.error('Disable split output (flag or config) for watch mode.');\n  }\n  throw e;\n}","preventionTips":["Audit repomix.config.json for split-output settings before enabling --watch","Use separate configs for watch vs one-shot split runs","Remember config-file values are validated only at watch startup, not CLI parse time"],"tags":["cli","watch-mode","conflicting-options"],"backgroundTag":"incompatible-cli-options","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}