coleam00/Archon · error · Error

Invalid --model '${assignment}'. Expected <small|medium|larg

Error message

Invalid --model '${assignment}'. Expected <small|medium|large|@alias>=<model>.

What it means

Thrown by parseRunModelAssignments when a --model assignment contains no usable '=' separator. Each assignment must be '<small|medium|large|@alias>=<model>'; one without '=' (or with '=' only at the end) cannot be split into name and spec.

Source

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

    defaultProvider: profile.defaultProvider,
    aliases: {
      ...profile.aliases,
      ...overrides.tiers,
      ...overrides.aliases,
    },
  };
}

/** Parse repeated CLI `name=spec` mappings into the shared transport shape. */
export function parseRunModelAssignments(assignments: readonly string[]): RunModelOverrides {
  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);

View on GitHub (pinned to 0773b97458)

Solutions

  1. Include '=' with both sides filled: '--model large=openai/gpt-4o'.
  2. Quote the assignment in the shell so '=' is not consumed: --model "@alias=my-model".
  3. Remove trailing '=' or leading '=' variants and supply the missing side.
  4. Check for stray whitespace or line-wrap artifacts in scripts that build the flag.

Example fix

// before
--model large
// after
--model large=anthropic/claude-sonnet-4
Defensive patterns

Strategy: validation

Validate before calling

function isValidAssignment(a: string): boolean {
  const eq = a.indexOf('=');
  return eq > 0 && eq < a.length - 1;
}

Type guard

function isParsableAssignment(a: string): a is `${string}=${string}` {
  const eq = a.indexOf('=');
  return eq > 0 && eq < a.length - 1;
}

Try / catch

try {
  parseRunModelAssignments(rawAssignments);
} catch (err) {
  if (err instanceof Error && err.message.startsWith('Invalid --model')) {
    console.error(`Bad --model flag: ${err.message}`);
    process.exitCode = 2;
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: modelOverrides receives assignments like 'large' (no '='), '=openai/gpt-4o' (empty name ⇒ equals===0), or 'large=' (equals===length-1).

Common situations: CLI users separating multiple --model flags with spaces but forgetting '='; shell quoting dropping the '='; copy-pasted flags where the value was lost.

Related errors


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