{"record":{"id":"9ccfa543e33577fb","repo":"coleam00/Archon","slug":"cannot-generate-schema-valid-dry-run-stub-for-node","errorCode":null,"errorMessage":"Cannot generate schema-valid dry-run stub for node '${node.id}': ${validation.errors.join('; ')}","messagePattern":"Cannot generate schema-valid dry-run stub for node '(.+?)': (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/workflows/src/dry-run.ts","lineNumber":190,"sourceCode":"    if (!isRecord(value)) {\n      throw new Error(\n        `Cannot generate dry-run stub for node '${node.id}': loop.until_field requires an object-typed output_format`\n      );\n    }\n    value[node.loop.until_field] = true;\n  }\n\n  let compileError: string | undefined;\n  const validation = validateStructuredOutput(value, node.output_format, message => {\n    compileError = message;\n  });\n  if (compileError !== undefined) {\n    throw new Error(\n      `Cannot generate dry-run stub for node '${node.id}': output_format could not be compiled (${compileError})`\n    );\n  }\n  if (!validation.valid) {\n    throw new Error(\n      `Cannot generate schema-valid dry-run stub for node '${node.id}': ${validation.errors.join('; ')}`\n    );\n  }\n  if (!isStubValue(value)) {\n    throw new Error(\n      `Cannot generate dry-run stub for node '${node.id}': output_format produced a placeholder of an unsupported type`\n    );\n  }\n  return value;\n}\n\nfunction stubSatisfiesNode(node: DagNode, stub: DryRunStubValue): boolean {\n  if (node.output_format !== undefined) {\n    const validation = validateStructuredOutput(stub, node.output_format);\n    if (!validation.valid) return false;\n  }\n  if (isLoopNode(node)) {\n    return loopIterationCompletes(node.loop, completedOutput(node, stub)).kind !== 'incomplete';","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/workflows/src/dry-run.ts#L172-L208","documentation":"Thrown by generatedStubFor when the compiled `output_format` schema produces a placeholder value that fails its own schema validation. Compilation succeeded, but generating a stub from the schema yielded a value with `validation.valid === false`. The message joins all zod-style validation errors so the developer sees exactly which constraints the generated stub violated.","triggerScenarios":"Dry-run stub generation on a node whose `output_format` is compilable but self-inconsistent — e.g. `required` properties whose generated placeholders violate constraints like `pattern`, `minLength`, `minimum`, or a contradictory `enum` + constraint combination.","commonSituations":"Schemas with `pattern` regexes the placeholder generator cannot satisfy, numeric `minimum`/`maximum` ranges the default placeholder falls outside, or `minLength`/`minItems` larger than generated defaults.","solutions":["Inspect the joined validation errors in the message; they name the failing paths and constraints.","Relax or correct the conflicting constraints in the node's `output_format` (e.g. widen `pattern`, lower `minLength`).","Provide explicit stubs for that node via a stub file so placeholder generation is skipped.","Test the schema standalone with a stub generator to confirm it can produce a valid instance."],"exampleFix":"// before\noutput_format:\n  type: object\n  required: [id]\n  properties:\n    id: { type: string, pattern: \"^[A-Z]{10,}$\" }\n// after\noutput_format:\n  type: object\n  required: [id]\n  properties:\n    id: { type: string }","handlingStrategy":"validation","validationCode":"function schemaCanProduceValidInstance(schema: Record<string, unknown>): boolean {\n  // spot-check contradictory constraints\n  const noPatternOnDefaults = typeof schema.pattern !== \"string\";\n  const saneNumeric =\n    typeof schema.minimum !== \"number\" ||\n    typeof schema.maximum !== \"number\" ||\n    schema.minimum <= schema.maximum;\n  return noPatternOnDefaults && saneNumeric;\n}","typeGuard":"function hasTriviallySatisfiableConstraints(s: { pattern?: string; minLength?: number; minimum?: number; maximum?: number }): boolean {\n  return !s.pattern && !(s.minLength && s.minLength > 1) &&\n    (s.minimum === undefined || s.maximum === undefined || s.minimum <= s.maximum);\n}","tryCatchPattern":"try {\n  const stub = generatedStubFor(node);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"Cannot generate schema-valid dry-run stub\")) {\n    console.warn(`Stub validation failed for ${node.id}; supply a manual stub.`, err.message);\n    return manualStubs[node.id];\n  }\n  throw err;\n}","preventionTips":["Avoid pattern/minLength constraints the placeholder generator cannot satisfy in stub-facing schemas.","Keep dry-run-facing output_formats minimal; save strict constraints for runtime validation.","Prefer explicit stub files for nodes with strict schemas.","Test scaffold generation whenever you tighten an output_format."],"tags":["dry-run","json-schema","validation","workflow"],"backgroundTag":"schema-validation-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}