coleam00/Archon · error · Error

Workflow run has invalid model_bindings ${path[1]} metadata.

Error message

Workflow run has invalid model_bindings ${path[1]} metadata.

What it means

When a run's model_bindings metadata fails schema validation and the failure sits under overrides.tiers or overrides.aliases, readRunModelBindingsMetadata throws that the run has invalid model_bindings tiers/aliases metadata. The dynamic path[1] segment reports which override map is corrupt. This guards execution against unusable tier/alias override maps.

Source

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

/** Read metadata written by this module; malformed external JSON fails explicitly. */
export function readRunModelBindingsMetadata(
  metadata: Record<string, unknown> | undefined
): RunModelBindingsMetadata | undefined {
  const value = metadata?.[RUN_MODEL_BINDINGS_METADATA_KEY];
  if (value === undefined) return undefined;
  const parsed = runModelBindingsMetadataSchema.safeParse(value);
  if (!parsed.success) {
    const path = parsed.error.issues[0]?.path ?? [];
    const bindingName = typeof path[2] === 'string' ? path[2] : 'unknown';
    if (path.includes('thinking')) {
      throw new Error(`Model binding '${bindingName}' has invalid thinking options.`);
    }
    if (path.includes('effort')) {
      throw new Error(`Model binding '${bindingName}' has an invalid effort.`);
    }
    if (path[0] === 'overrides' && (path[1] === 'tiers' || path[1] === 'aliases')) {
      throw new Error(`Workflow run has invalid model_bindings ${path[1]} metadata.`);
    }
    if (path[0] === 'effective') {
      throw new Error('Workflow run has invalid effective model bindings.');
    }
    throw new Error('Workflow run has invalid model_bindings metadata.');
  }

  const tiers = Object.fromEntries(
    Object.entries(parsed.data.overrides.tiers ?? {}).map(([name, preset]) => [
      name,
      normalizePersistedOverridePreset(name, preset),
    ])
  );
  const aliases = Object.fromEntries(
    Object.entries(parsed.data.overrides.aliases ?? {}).map(([name, preset]) => [
      name,
      normalizePersistedOverridePreset(name, preset),
    ])

View on GitHub (pinned to 0773b97458)

Solutions

  1. Fix the overrides.tiers/overrides.aliases entries in the run's model_bindings metadata so they conform to runModelBindingsMetadataSchema
  2. Re-create the run with valid model_bindings metadata
  3. Audit the writer that persisted the overrides to emit schema-conformant shapes

Example fix

// before
"overrides": { "tiers": { "small": 42 } }
// after
"overrides": { "tiers": { "small": "gpt-4o-mini" } }
Defensive patterns

Strategy: validation

Validate before calling

const parsed = runModelBindingsMetadataSchema.safeParse(metadata);
if (!parsed.success) {
  const bad = parsed.error.issues.find(i => i.path[0] === 'overrides' && (i.path[1] === 'tiers' || i.path[1] === 'aliases'));
  if (bad) throw new Error(`Invalid overrides.${String(bad.path[1])} metadata: ${bad.message} at ${bad.path.join('.')}`);
}

Type guard

function hasValidOverrides(m: { overrides?: unknown }): boolean {
  return runModelBindingsMetadataSchema.pick({ overrides: true }).safeParse({ overrides: m.overrides }).success;
}

Try / catch

try {
  await executeWorkflow(runId);
} catch (err) {
  if (err instanceof Error && /invalid model_bindings (tiers|aliases) metadata/.test(err.message)) {
    console.error(`${err.message} — repair overrides in model_bindings or start a new run.`);
  } else throw err;
}

Prevention

When it happens

Trigger: executeWorkflow loads a run whose overrides.tiers or overrides.aliases object inside model_bindings fails safeParse — wrong value shapes, non-string model specs, or unexpected types in the persisted metadata.

Common situations: Direct database edits or backfills of run metadata; a writer bug or version drift producing override maps the current schema rejects; copying runs between installs with different metadata writers.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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