can1357/oh-my-pi · error · CliUsageError

--in-place and --out are mutually exclusive

Error message

--in-place and --out are mutually exclusive

What it means

omp compress can write results either back to the original files (--in-place) or to a path given by --out. Using both at once is ambiguous about the destination, so the command rejects the combination with a CliUsageError.

Source

Thrown at packages/coding-agent/src/commands/compress.ts:34

		agents: Flags.integer({ char: "n", description: "Files compressed concurrently", default: 4 }),
		model: Flags.string({ char: "m", description: "Model selector" }),
	};

	static examples = [
		"omp compress prompts/tools/read.md",
		"omp compress notes.md -o notes.compressed.md",
		"omp compress 'src/prompts/**/*.md' -i",
		"omp compress a.md b.md c.md -i -n 8",
		"omp compress spec.md -r 5 -m opus",
	];

	async run(): Promise<void> {
		const { args, flags } = await this.parse(Compress);
		const files = args.files ?? [];
		if (files.length === 0) throw new CliUsageError("compress requires at least one file or glob pattern");
		if (flags.rounds <= 0) throw new CliUsageError("--rounds must be a positive integer");
		if (flags.agents <= 0) throw new CliUsageError("--agents must be a positive integer");
		if (flags.inPlace && flags.out) throw new CliUsageError("--in-place and --out are mutually exclusive");
		const result = await runCompressCommand({
			files,
			model: flags.model,
			maxRounds: flags.rounds,
			concurrency: flags.agents,
			output: flags.out,
			inPlace: flags.inPlace,
		});
		await postmortem.quit(result.exitCode);
	}
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Pick one destination mode: drop --out to modify files in place, or drop --in-place to write to the --out path
  2. If the script needs both behaviors, branch on a mode flag instead of passing both
  3. Update wrapper scripts so they do not unconditionally inject --out

Example fix

// before
omp compress spec.md --in-place --out result.md
// after
omp compress spec.md --in-place   # or: omp compress spec.md --out result.md
Defensive patterns

Strategy: validation

Validate before calling

const flags = { inPlace: true, out: 'result.md' };
if (flags.inPlace && flags.out) {
  throw new Error('choose one output mode: --in-place or --out, not both');
}

Try / catch

try {
  await Compress.run(rawArgs);
} catch (err) {
  if (err instanceof CliUsageError && err.message.includes('mutually exclusive')) {
    console.error('Use --in-place OR --out, not both.');
    process.exitCode = 1;
  } else throw err;
}

Prevention

When it happens

Trigger: 'omp compress spec.md --in-place --out result.md'; wrappers that always append --out while a user also adds --in-place.

Common situations: Combining a personal alias/script default (--out always set) with a manually typed --in-place; migrating scripts where the output mode changed mid-flight.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/fdbaf9ac1c519e17. Report an issue: GitHub.