{"record":{"id":"96086e8b55ba17f3","repo":"coleam00/Archon","slug":"model-binding-bindingname-has-an-invalid-effo","errorCode":null,"errorMessage":"Model binding '${bindingName}' has an invalid effort.","messagePattern":"Model binding '(.+?)' has an invalid effort\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/workflows/src/model-validation.ts","lineNumber":504,"sourceCode":"    },\n  };\n}\n\n/** Read metadata written by this module; malformed external JSON fails explicitly. */\nexport function readRunModelBindingsMetadata(\n  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]) => [","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/workflows/src/model-validation.ts#L486-L522","documentation":"readRunModelBindingsMetadata validates a run's model_bindings metadata with runModelBindingsMetadataSchema. When validation fails and the first issue path contains 'effort', it throws this error naming the binding whose reasoning-effort value is invalid. Invalid persisted effort values cannot be mapped onto a provider call, so execution stops early with a clear message.","triggerScenarios":"executeWorkflow reads a run whose stored binding entry has an effort value outside the schema's enum (e.g. 'maximum' or a misspelled 'hight'); metadata written by a different/older schema version; hand-edited database rows.","commonSituations":"Typo in an effort value when editing run metadata; writer/reader schema drift after an upgrade; test fixtures with made-up effort strings.","solutions":["Correct the binding's effort value in the run's model_bindings metadata to a schema-valid effort (e.g. minimal|low|medium|high per the schema)","Delete and re-launch the run with valid model_bindings","Check which writer produced the metadata and align it with runModelBindingsMetadataSchema"],"exampleFix":"// before\n\"bindings\": { \"node1\": { \"effort\": \"maximum\" } }\n// after\n\"bindings\": { \"node1\": { \"effort\": \"high\" } }","handlingStrategy":"validation","validationCode":"const parsed = runModelBindingsMetadataSchema.safeParse(metadata);\nif (!parsed.success) {\n  const bad = parsed.error.issues.find(i => i.path.includes('effort'));\n  if (bad) throw new Error(`Binding '${String(bad.path[2])}' has invalid effort: ${bad.message}`);\n}","typeGuard":"function hasValidEffort(b: { effort?: unknown }): boolean {\n  return runModelBindingsMetadataSchema.shape.bindings\n    .element.pick({ effort: true }).safeParse(b).success;\n}","tryCatchPattern":"try {\n  await executeWorkflow(runId);\n} catch (err) {\n  if (err instanceof Error && /has an invalid effort/.test(err.message)) {\n    console.error(`${err.message} — fix the effort value in model_bindings metadata.`);\n  } else throw err;\n}","preventionTips":["Only use effort values from the schema's enum, not free-form strings","Type the effort field with the exported union type so invalid values fail at compile time","Validate metadata fixtures with the schema before persisting them in tests"],"tags":["validation","metadata","effort"],"backgroundTag":"schema-validation-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}