{"record":{"id":"4d87e70f68f7cf3e","repo":"coleam00/Archon","slug":"workflow-run-has-invalid-effective-model-bindings","errorCode":null,"errorMessage":"Workflow run has invalid effective model bindings.","messagePattern":"Workflow run has invalid effective model bindings\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/workflows/src/model-validation.ts","lineNumber":510,"sourceCode":"  metadata: Record<string, unknown> | undefined\n): RunModelBindingsMetadata | undefined {\n  const value = metadata?.[RUN_MODEL_BINDINGS_METADATA_KEY];\n  if (value === undefined) return undefined;\n  const parsed = runModelBindingsMetadataSchema.safeParse(value);\n  if (!parsed.success) {\n    const path = parsed.error.issues[0]?.path ?? [];\n    const bindingName = typeof path[2] === 'string' ? path[2] : 'unknown';\n    if (path.includes('thinking')) {\n      throw new Error(`Model binding '${bindingName}' has invalid thinking options.`);\n    }\n    if (path.includes('effort')) {\n      throw new Error(`Model binding '${bindingName}' has an invalid effort.`);\n    }\n    if (path[0] === 'overrides' && (path[1] === 'tiers' || path[1] === 'aliases')) {\n      throw new Error(`Workflow run has invalid model_bindings ${path[1]} metadata.`);\n    }\n    if (path[0] === 'effective') {\n      throw new Error('Workflow run has invalid effective model bindings.');\n    }\n    throw new Error('Workflow run has invalid model_bindings metadata.');\n  }\n\n  const tiers = Object.fromEntries(\n    Object.entries(parsed.data.overrides.tiers ?? {}).map(([name, preset]) => [\n      name,\n      normalizePersistedOverridePreset(name, preset),\n    ])\n  );\n  const aliases = Object.fromEntries(\n    Object.entries(parsed.data.overrides.aliases ?? {}).map(([name, preset]) => [\n      name,\n      normalizePersistedOverridePreset(name, preset),\n    ])\n  );\n  for (const [name, preset] of Object.entries(parsed.data.effective.aliases)) {\n    assertValidPersistedPreset(name, preset);","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/workflows/src/model-validation.ts#L492-L528","documentation":"readRunModelBindingsMetadata also validates the 'effective' section of model_bindings metadata (the resolved bindings actually used for execution). If safeParse fails with a path rooted at 'effective', it throws this error. Effective bindings are recomputed-but-persisted state; if they are invalid, the run record is internally inconsistent and execution refuses to proceed rather than trusting corrupt data.","triggerScenarios":"executeWorkflow reads a run whose persisted effective bindings section fails runModelBindingsMetadataSchema — e.g. malformed binding entries under effective/ written by a buggy or older writer, or manual database tampering.","commonSituations":"Version drift between the binary that wrote the run and the binary resuming it; a writer bug persisting effective bindings before overrides were normalized; manual edits to run rows.","solutions":["Recompute and rewrite the effective bindings section (or delete the run and start a new one) so it matches the schema","Resume from a run whose metadata was written by a compatible writer version","Fix the writer that persists effective bindings to conform to runModelBindingsMetadataSchema"],"exampleFix":"// before\n\"effective\": { \"node1\": \"gpt-4o-mini\" }\n// after\n\"effective\": { \"node1\": { \"model\": \"gpt-4o-mini\" } }","handlingStrategy":"try-catch","validationCode":"const parsed = runModelBindingsMetadataSchema.safeParse(metadata);\nif (!parsed.success) {\n  if (parsed.error.issues.some(i => i.path[0] === 'effective')) {\n    throw new Error('Workflow run has invalid effective model bindings.');\n  }\n}","typeGuard":"function hasValidEffectiveBindings(m: { effective?: unknown }): boolean {\n  return runModelBindingsMetadataSchema.pick({ effective: true }).safeParse({ effective: m.effective }).success;\n}","tryCatchPattern":"try {\n  await executeWorkflow(runId);\n} catch (err) {\n  if (err instanceof Error && err.message === 'Workflow run has invalid effective model bindings.') {\n    console.error('Persisted effective bindings are corrupt; recompute them or start a new run.');\n  } else throw err;\n}","preventionTips":["Treat effective bindings as engine-owned: never write or edit them externally","Ensure resuming runs uses a compatible writer version for the effective section","Add a round-trip test that persists a run, re-reads, and safeParses the full metadata including effective"],"tags":["validation","metadata","effective-bindings"],"backgroundTag":"schema-validation-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}