Yeachan-Heo/oh-my-codex · error · Error
Conflicting setup AGENTS merge policy flags: ${source} confl
Error message
Conflicting setup AGENTS merge policy flags: ${source} conflicts with another merge policy selector. What it means
The `setup` command's AGENTS merge policy can only be selected once. `resolveSetupAgentsMergePolicyArg` throws when two conflicting policy flags are given — i.e. a second flag of a different kind, or two `set`-kind flags with different values (`--merge-agents` vs `--no-merge-agents`).
Source
Thrown at src/cli/index.ts:535
"team",
"tmux-hook",
]);
export interface ResolvedCliInvocation {
command: CliCommand;
launchArgs: string[];
}
export type SetupMergeAgentsPolicyArg =
| { kind: "set"; value: boolean }
| { kind: "clear" }
| undefined;
export function resolveSetupAgentsMergePolicyArg(args: string[]): SetupMergeAgentsPolicyArg {
let policy: SetupMergeAgentsPolicyArg;
const setPolicy = (next: Exclude<SetupMergeAgentsPolicyArg, undefined>, source: string): void => {
if (policy && (policy.kind !== next.kind || (policy.kind === "set" && next.kind === "set" && policy.value !== next.value))) {
throw new Error(`Conflicting setup AGENTS merge policy flags: ${source} conflicts with another merge policy selector.`);
}
policy = next;
};
for (let index = 0; index < args.length; index += 1) {
const arg = args[index];
if (arg === "--merge-agents" || arg === "--no-merge-agents" || arg === "--clear-merge-agents-policy") {
const next = args[index + 1];
if (next && !next.startsWith("--")) {
throw new Error(`Setup AGENTS merge policy flags do not accept values: ${arg} ${next}`);
}
if (arg === "--merge-agents") {
setPolicy({ kind: "set", value: true }, arg);
} else if (arg === "--no-merge-agents") {
setPolicy({ kind: "set", value: false }, arg);
} else {
setPolicy({ kind: "clear" }, arg);
}
} else if (View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Use exactly one merge policy flag per invocation
- Pick the policy you actually want: --merge-agents, --no-merge-agents, or --clear-merge-agents-policy
- Split conflicting policies into separate setup runs if both behaviors are needed over time
Example fix
# before omx setup --merge-agents --clear-merge-agents-policy # after omx setup --merge-agents
Defensive patterns
Strategy: validation
Validate before calling
const POLICY_FLAGS = ['--merge-agents', '--no-merge-agents', '--clear-merge-agents-policy'];
const used = args.filter(a => POLICY_FLAGS.includes(a));
const uniqueKinds = new Set(used);
if (uniqueKinds.size > 1) {
console.error('Only one AGENTS merge policy flag is allowed');
process.exit(1);
} Try / catch
try {
await main(args);
} catch (e) {
if ((e as Error).message.startsWith('Conflicting setup AGENTS merge policy flags')) {
// strip all but one policy flag and retry
} else throw e;
} Prevention
- Build CLI args from a single source of truth config
- Never merge flag lists from multiple templates
When it happens
Trigger: Passing more than one of `--merge-agents`, `--no-merge-agents`, `--clear-merge-agents-policy` with differing kinds, e.g. `omx setup --merge-agents --clear-merge-agents-policy` or `omx setup --merge-agents --no-merge-agents`. Repeating the identical flag is fine; conflicting combinations throw.
Common situations: Combining flags copy-pasted from different docs or config templates; shell scripts accumulating options from multiple env sources.
Related errors
- Conflicting setup install mode flags: ${source} selects ${ne
- Conflicting setup MCP mode flags: ${source} selects ${next},
- Conflicting setup Team mode flags: ${source} selects ${next}
- --keep-policy must be one of: score_improvement, pass_only
- Unknown capabilities subcommand: ${parsed.subcommand}
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/96c6170323d83385.
Report an issue: GitHub.