coleam00/Archon · error · Error

Duplicate --model binding '${name}'.

Error message

Duplicate --model binding '${name}'.

What it means

parseRunModelAssignments parses CLI --model flags of the form <small|medium|large|@alias>=<model>. This error means the same tier or alias name was assigned more than once in one invocation, which would make the resolved model configuration ambiguous, so the parser rejects it instead of letting a later flag silently win.

Source

Thrown at packages/workflows/src/model-validation.ts:439

  const tiers: Partial<Record<TierName, string>> = {};
  const aliases: Record<string, string> = {};
  const seen = new Set<string>();

  for (const assignment of assignments) {
    const equals = assignment.indexOf('=');
    if (equals <= 0 || equals === assignment.length - 1) {
      throw new Error(
        `Invalid --model '${assignment}'. Expected <small|medium|large|@alias>=<model>.`
      );
    }
    const name = assignment.slice(0, equals).trim();
    const spec = assignment.slice(equals + 1).trim();
    if (name.length === 0 || spec.length === 0) {
      throw new Error(
        `Invalid --model '${assignment}'. Expected <small|medium|large|@alias>=<model>.`
      );
    }
    if (seen.has(name)) throw new Error(`Duplicate --model binding '${name}'.`);
    seen.add(name);

    if (isTierName(name)) {
      tiers[name] = spec;
    } else {
      assertNotReserved(name);
      assertCustomAliasPrefix(name);
      aliases[name] = spec;
    }
  }

  return {
    ...(Object.keys(tiers).length > 0 ? { tiers } : {}),
    ...(Object.keys(aliases).length > 0 ? { aliases } : {}),
  };
}

export function hasRunModelOverrides(overrides: ResolvedRunModelOverrides): boolean {

View on GitHub (pinned to 0773b97458)

Solutions

  1. Remove the duplicate --model flag so each tier/alias name appears exactly once
  2. Deduplicate the assignments list before invoking (keep the last intended value or merge sources)
  3. If merging config layers is intended, resolve duplicates in the layering code before passing to modelOverrides

Example fix

// before
--model small=gpt-4o-mini --model medium=gpt-4o --model small=claude-haiku
// after
--model small=claude-haiku --model medium=gpt-4o
Defensive patterns

Strategy: validation

Validate before calling

function validateModelAssignments(assignments: string[]): void {
  const seen = new Set<string>();
  for (const a of assignments) {
    const eq = a.indexOf('=');
    if (eq === -1) throw new Error(`Invalid --model '${a}'. Expected <small|medium|large|@alias>=<model>.`);
    const name = a.slice(0, eq).trim();
    if (name.length === 0 || a.slice(eq + 1).trim().length === 0) throw new Error(`Invalid --model '${a}'.`);
    if (seen.has(name)) throw new Error(`Duplicate --model binding '${name}'.`);
    seen.add(name);
  }
}

Try / catch

try {
  parseRunModelAssignments(args);
} catch (err) {
  if (err instanceof Error && err.message.includes('Duplicate --model binding')) {
    console.error('Each tier/alias may be bound at most once. Fix the --model flags.');
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: Passing --model small=gpt-4o-mini --model small=claude-haiku (or a repeated @alias binding) in a single run command; the same name appearing twice in an assignments array passed to parseRunModelAssignments (or modelOverrides).

Common situations: Shell scripts that accumulate --model flags from multiple config sources and concatenate duplicates; copy-pasting a flag into a run command that already contained it; wrapper tooling building the flag list programmatically without deduplication.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/21df6d72ce7ad626. Report an issue: GitHub.