coleam00/Archon · error · Error

Cannot generate dry-run scaffold: nodes sharing stub key '${

Error message

Cannot generate dry-run scaffold: nodes sharing stub key '${id}' require incompatible values

What it means

Thrown by createDryRunStubScaffold when multiple nodes share a stub key (node id) but their `output_format` schemas are mutually incompatible: no single candidate value satisfies every consumer node. Since one stub value must be shared across the key, the scaffold cannot be built.

Source

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

          existing.candidates.push(generated);
          existing.consumers.push(node);
        }
      }
      if (isLoopGroupNode(node)) visit(node.loop_group.nodes as DagNode[]);
    }
  };
  // "Already-expanded" per this function's own docblock — dry-run always simulates a
  // fully-expanded WorkflowDefinition, so `workflow.nodes` never actually holds an
  // `IncludeDirective` here even though the type admits one for the general
  // pre-expansion case (#2486).
  visit(workflow.nodes as DagNode[]);
  return Object.fromEntries(
    [...stubs].map(([id, entry]) => {
      const value = entry.candidates.find(candidate =>
        entry.consumers.every(consumer => stubSatisfiesNode(consumer, candidate))
      );
      if (value === undefined) {
        throw new Error(
          `Cannot generate dry-run scaffold: nodes sharing stub key '${id}' require incompatible values`
        );
      }
      return [id, value];
    })
  );
}

/** Write a scaffold without ever overwriting an existing fixture. */
export async function writeDryRunStubScaffold(
  workflow: WorkflowDefinition,
  path: string
): Promise<DryRunStubs> {
  const stubs = createDryRunStubScaffold(workflow);
  await mkdir(dirname(path), { recursive: true });
  let handle;
  try {
    handle = await open(path, 'wx');

View on GitHub (pinned to 0773b97458)

Solutions

  1. Give each node a unique id — duplicate ids are the usual root cause.
  2. If sharing is intentional, align the `output_format` schemas of the colliding nodes to a common shape.
  3. Write a manual stub file whose value satisfies all consumers instead of relying on the scaffold.

Example fix

// before (two nodes both id: summarize)
- id: summarize
  output_format: { type: object, properties: { text: { type: string } } }
- id: summarize
  output_format: { type: object, properties: { score: { type: number } } }
// after
- id: summarize-text
  output_format: { type: object, properties: { text: { type: string } } }
- id: summarize-score
  output_format: { type: object, properties: { score: { type: number } } }
Defensive patterns

Strategy: validation

Validate before calling

function assertUniqueNodeIds(nodes: { id: string }[]): void {
  const seen = new Set<string>();
  for (const n of nodes) {
    if (seen.has(n.id)) throw new Error(`Duplicate node id: ${n.id}`);
    seen.add(n.id);
  }
}

Type guard

function hasDuplicateIds(ids: string[]): boolean {
  return new Set(ids).size !== ids.length;
}

Try / catch

try {
  const scaffold = await createDryRunStubScaffold(dag);
} catch (err) {
  if (err instanceof Error && err.message.includes("require incompatible values")) {
    console.error("Duplicate node id with divergent output_format; fix ids or align schemas:", err.message);
  } else throw err;
}

Prevention

When it happens

Trigger: Running scaffold/stubs generation on a workflow where two or more nodes have the same id (duplicate node ids) but different `output_format` schemas, so no generated candidate passes stubSatisfiesNode for all consumers.

Common situations: Copy-pasting a node and forgetting to change its id, refactoring that merged node ids, or templated workflows that emit duplicate ids with diverging output schemas.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/6df4dfe2e274c41c. Report an issue: GitHub.