coleam00/Archon · error · Error

Cannot generate schema-valid dry-run stub for node '${node.i

Error message

Cannot generate schema-valid dry-run stub for node '${node.id}': ${validation.errors.join('; ')}

What it means

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.

Source

Thrown at packages/workflows/src/dry-run.ts:190

    if (!isRecord(value)) {
      throw new Error(
        `Cannot generate dry-run stub for node '${node.id}': loop.until_field requires an object-typed output_format`
      );
    }
    value[node.loop.until_field] = true;
  }

  let compileError: string | undefined;
  const validation = validateStructuredOutput(value, node.output_format, message => {
    compileError = message;
  });
  if (compileError !== undefined) {
    throw new Error(
      `Cannot generate dry-run stub for node '${node.id}': output_format could not be compiled (${compileError})`
    );
  }
  if (!validation.valid) {
    throw new Error(
      `Cannot generate schema-valid dry-run stub for node '${node.id}': ${validation.errors.join('; ')}`
    );
  }
  if (!isStubValue(value)) {
    throw new Error(
      `Cannot generate dry-run stub for node '${node.id}': output_format produced a placeholder of an unsupported type`
    );
  }
  return value;
}

function stubSatisfiesNode(node: DagNode, stub: DryRunStubValue): boolean {
  if (node.output_format !== undefined) {
    const validation = validateStructuredOutput(stub, node.output_format);
    if (!validation.valid) return false;
  }
  if (isLoopNode(node)) {
    return loopIterationCompletes(node.loop, completedOutput(node, stub)).kind !== 'incomplete';

View on GitHub (pinned to 0773b97458)

Solutions

  1. Inspect the joined validation errors in the message; they name the failing paths and constraints.
  2. Relax or correct the conflicting constraints in the node's `output_format` (e.g. widen `pattern`, lower `minLength`).
  3. Provide explicit stubs for that node via a stub file so placeholder generation is skipped.
  4. Test the schema standalone with a stub generator to confirm it can produce a valid instance.

Example fix

// before
output_format:
  type: object
  required: [id]
  properties:
    id: { type: string, pattern: "^[A-Z]{10,}$" }
// after
output_format:
  type: object
  required: [id]
  properties:
    id: { type: string }
Defensive patterns

Strategy: validation

Validate before calling

function schemaCanProduceValidInstance(schema: Record<string, unknown>): boolean {
  // spot-check contradictory constraints
  const noPatternOnDefaults = typeof schema.pattern !== "string";
  const saneNumeric =
    typeof schema.minimum !== "number" ||
    typeof schema.maximum !== "number" ||
    schema.minimum <= schema.maximum;
  return noPatternOnDefaults && saneNumeric;
}

Type guard

function hasTriviallySatisfiableConstraints(s: { pattern?: string; minLength?: number; minimum?: number; maximum?: number }): boolean {
  return !s.pattern && !(s.minLength && s.minLength > 1) &&
    (s.minimum === undefined || s.maximum === undefined || s.minimum <= s.maximum);
}

Try / catch

try {
  const stub = generatedStubFor(node);
} catch (err) {
  if (err instanceof Error && err.message.startsWith("Cannot generate schema-valid dry-run stub")) {
    console.warn(`Stub validation failed for ${node.id}; supply a manual stub.`, err.message);
    return manualStubs[node.id];
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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/9ccfa543e33577fb. Report an issue: GitHub.