Yeachan-Heo/oh-my-codex · error

Invalid ${source}: conflicting duplicate ${axis} policy

Error message

Invalid ${source}: conflicting duplicate ${axis} policy

What it means

The same policy axis (approval or sandbox) is specified more than once in the launch args with different values. setDirectPolicyValue only allows repeating a flag if the value is identical (idempotent).

Source

Thrown at src/team/model-contract.ts:334

): string {
  if (typeof value !== 'string') {
    throw teamWorkerLaunchArgsError(source, `missing value for ${flag}`);
  }
  const normalized = value.trim();
  if (normalized === '' || normalized.startsWith('-')) {
    throw teamWorkerLaunchArgsError(source, `missing value for ${flag}`);
  }
  return value;
}

function setDirectPolicyValue(
  existingValue: string | null,
  value: string,
  axis: PolicyAxis,
  source: string,
): string {
  if (existingValue !== null && existingValue !== value) {
    throw teamWorkerLaunchArgsError(source, `conflicting duplicate ${axis} policy`);
  }
  return value;
}

function directPolicySelector(arg: string): { axis: 'approval' | 'sandbox'; flag: string; value?: string } | null {
  if (arg === TEAM_WORKER_APPROVAL_FLAG || arg === '-a') {
    return { axis: 'approval', flag: TEAM_WORKER_APPROVAL_FLAG };
  }
  if (arg.startsWith(`${TEAM_WORKER_APPROVAL_FLAG}=`)) {
    return {
      axis: 'approval',
      flag: TEAM_WORKER_APPROVAL_FLAG,
      value: arg.slice(`${TEAM_WORKER_APPROVAL_FLAG}=`.length),
    };
  }
  if (arg.startsWith('-a=')) {
    return { axis: 'approval', flag: TEAM_WORKER_APPROVAL_FLAG, value: arg.slice(3) };
  }

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Remove the duplicate so each axis is set once
  2. If re-declaring, use the identical value
  3. Use the merge/override API instead of concatenating raw arg strings

Example fix

# before
'--approval auto --approval never'
# after
'--approval auto'
Defensive patterns

Strategy: validation

Validate before calling

const seen = new Map<string, string>();
for (const { axis, value } of policyFlags) {
  if (seen.has(axis) && seen.get(axis) !== value) throw new Error('conflict');
  seen.set(axis, value);
}

Prevention

When it happens

Trigger: Args containing e.g. both '--approval auto' and '--approval never', or a -a short form conflicting with the long form.

Common situations: Inherited leader args already set a policy and the env var tries to override it with a different value; concatenating arg lists naively.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/a0b1bd9b02f7fb51. Report an issue: GitHub.