{"record":{"id":"947fa3a2576577cf","repo":"coleam00/Archon","slug":"node-node-id-output-format-declared-but-the","errorCode":null,"errorMessage":"Node '${node.id}': output_format declared but the provider's structured output failed schema validation: ${validation.errors.join('; ')}","messagePattern":"Node '(.+?)': output_format declared but the provider's structured output failed schema validation: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/workflows/src/dag-executor.ts","lineNumber":3052,"sourceCode":"          } catch (serializeErr) {\n            const err = serializeErr as Error;\n            throw new Error(\n              `Node '${node.id}': failed to serialize structured_output to JSON: ${err.message}`\n            );\n          }\n          getLog().debug({ nodeId: node.id, streamingMode }, 'dag.structured_output_override');\n          break;\n        }\n        // Invalid payload.\n        getLog().warn(\n          { nodeId: node.id, workflowRunId: workflowRun.id, errors: validation.errors },\n          'dag.structured_output_invalid'\n        );\n        if (canReask) {\n          await scheduleReask(validation.errors);\n          continue;\n        }\n        throw new Error(\n          `Node '${node.id}': output_format declared but the provider's structured output failed schema validation: ${validation.errors.join('; ')}`\n        );\n      }\n\n      // No structured output at all (prose / refusal / parse miss / timeout).\n      getLog().warn(\n        { nodeId: node.id, workflowRunId: workflowRun.id },\n        'dag.structured_output_missing'\n      );\n      if (canReask) {\n        await scheduleReask(['no JSON object was found in the response']);\n        continue;\n      }\n      // Surface the real cause: a timeout/abort produces no structured output too,\n      // and reporting it as \"the model replied with prose\" would mislead.\n      if (nodeIdleTimedOut) {\n        throw new Error(\n          `Node '${node.id}': timed out (no output for ${String(effectiveIdleTimeout / 60000)} min) before producing the required structured output.`","sourceCodeStart":3034,"sourceCodeEnd":3070,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/workflows/src/dag-executor.ts#L3034-L3070","documentation":"A node declared output_format, the provider produced structured output, but it failed schema validation. After exhausting reask attempts (scheduleReask asking the model to fix the listed errors), the executor throws with the joined validation errors so the developer sees exactly which schema constraints failed.","triggerScenarios":"Model output parses as a JSON object but violates the declared output_format schema (missing required fields, wrong types, extra constraints); reask retries were attempted and still failed or reasks were not possible (canReask false).","commonSituations":"An overly strict or incorrect JSON schema for a fuzzy task; model omitting required fields; enum/type mismatches; model ignoring reask instructions on complex schemas.","solutions":["Read the joined validation.errors in the message and relax/correct the output_format schema accordingly.","Make required fields optional with defaults, or loosen types/enums the model keeps missing.","Improve the node prompt: show the schema and an example of a valid output object.","Split complex outputs into multiple nodes with smaller schemas, or enable/raise reask attempts."],"exampleFix":"// before\noutput_format:\n  type: object\n  required: [summary, confidence, sources, owner, eta]\n// after\noutput_format:\n  type: object\n  required: [summary]\n  properties: { summary: { type: string }, confidence: { type: number } }","handlingStrategy":"validation","validationCode":"import Ajv from 'ajv';\nconst ajv = new Ajv();\nconst validate = ajv.compile(node.output_format);\nif (!validate(sampleModelOutput)) console.error('Schema too strict:', ajv.errorsText(validate.errors));","typeGuard":"function passesSchema(out: unknown, schema: object): boolean {\n  return validateAgainstSchema(out, schema).valid;\n}","tryCatchPattern":"try {\n  await runNode(node);\n} catch (e) {\n  if (String(e).includes('failed schema validation')) console.error('Relax schema or improve prompt; errors:', e.message);\n  else throw e;\n}","preventionTips":["Test output_format schemas against sample model outputs before shipping.","Keep schemas minimal — require only fields you consume.","Show the schema and a valid example in the node prompt.","Enable reask so the model can self-correct validation errors."],"tags":["schema-validation","structured-output","json-schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}