yamadashy/repomix · error · RepomixError
--watch cannot be used with --skill-generate. Watch mode doe
Error message
--watch cannot be used with --skill-generate. Watch mode does not support skill generation.
What it means
Skill generation (`--skill-generate`) is a one-shot output artifact not supported while watching. `runWatchAction` rejects `--watch` combined with `config.skillGenerate` being set.
Source
Thrown at src/cli/actions/watchAction.ts:93
const config = await buildMergedConfig(cwd, cliOptions);
// Watch-specific incompatibilities. Each of these is independently incompatible with
// --watch and can also be set via the config file (which validateWatchOptions in cliRun,
// CLI-flags-only, does not see), so re-check them on the merged config here. They are
// checked individually rather than via the shared validateConflictingOptions so the error
// always names --watch instead of a (potentially confusing) pairwise conflict.
if (config.output.splitOutput !== undefined) {
// Split output would create numbered files that the watcher then picks up, looping.
throw new RepomixError(
'--watch cannot be used with split output. Watch mode does not yet support split output files.',
);
}
// `output: "-"` resolves to stdout mode via filePath === '-', the same as --stdout.
if (config.output.stdout || config.output.filePath === '-') {
throw new RepomixError('--watch cannot be used with stdout output. Watch mode writes to a file.');
}
if (config.skillGenerate !== undefined) {
throw new RepomixError(
'--watch cannot be used with --skill-generate. Watch mode does not support skill generation.',
);
}
if (config.output.copyToClipboard) {
throw new RepomixError(
'--watch cannot be used with --copy. Watch mode re-packs on every change, which would repeatedly overwrite the clipboard.',
);
}
const targetPaths = directories.map((directory) => path.resolve(cwd, directory));
// Run initial pack
const packResult = await runPack(targetPaths, config, cliOptions);
reportResults(cwd, packResult, config, cliOptions);
logger.log(pc.dim(`\nWatching ${packResult.safeFilePaths.length} files for changes... (Ctrl+C to stop)\n`));
// Watch target directories instead of individual files so new files are detected.
// The ignore predicate mirrors the packer so chokidar stays out of node_modules/.gitView on GitHub (pinned to f465ad9093)
Solutions
- Run `--skill-generate` without `--watch`
- Re-run the skill generation command manually when the repo changes
- Use a script/cron to periodically run skill generation instead of watch mode
Example fix
// before repomix --watch --skill-generate my-skill // after repomix --skill-generate my-skill # one-shot, no --watch
Defensive patterns
Strategy: validation
Validate before calling
if (watch && (argv.includes('--skill-generate') || cfg.skillGenerate != null)) {
throw new Error('Run --skill-generate as a one-shot command without --watch');
} Type guard
null
Try / catch
try {
await runRepomix({ watch: true });
} catch (e) {
if (e instanceof RepomixError && e.message.includes('--skill-generate')) {
console.error('Run skill generation separately, without --watch.');
}
throw e;
} Prevention
- Treat --skill-generate as one-shot only
- Automate regeneration via scripts/cron instead of watch mode
When it happens
Trigger: Running `repomix --watch --skill-generate <name>`, or `--watch` with `skillGenerate` set in the config file.
Common situations: A user generating an AI skill file from a repo then tries to keep it updated automatically with watch mode.
Related errors
- --watch cannot be used with split output. Watch mode does no
- --watch cannot be used with stdout output. Watch mode writes
- --watch cannot be used with --copy. Watch mode re-packs on e
- --skill-output can only be used with --skill-generate
- --force can only be used with --skill-generate
AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29).
Data as JSON: /api/errors/d96e1ac01b970ed5.
Report an issue: GitHub.