{"record":{"id":"6eb9791d8363c29e","repo":"coleam00/Archon","slug":"invalid-dry-run-stub-file-path-expected-one","errorCode":null,"errorMessage":"Invalid dry-run stub file '${path}': expected one YAML mapping of node ids to outputs","messagePattern":"Invalid dry-run stub file '(.+?)': expected one YAML mapping of node ids to outputs","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/workflows/src/dry-run.ts","lineNumber":397,"sourceCode":"});\nexport type DryRunResult = z.infer<typeof dryRunResultSchema>;\n\nexport async function loadDryRunStubs(path?: string): Promise<DryRunStubs> {\n  if (!path) return {};\n  const file = Bun.file(path);\n  if (!(await file.exists())) {\n    throw new Error(`Dry-run stub file not found: ${path}`);\n  }\n\n  let parsed: unknown;\n  try {\n    parsed = Bun.YAML.parse(await file.text());\n  } catch (error) {\n    throw new Error(`Failed to parse dry-run stub file '${path}': ${(error as Error).message}`);\n  }\n\n  if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {\n    throw new Error(\n      `Invalid dry-run stub file '${path}': expected one YAML mapping of node ids to outputs`\n    );\n  }\n  const reservedHit = Object.keys(parsed as Record<string, unknown>).find(key =>\n    RESERVED_FIXTURE_KEYS.has(key)\n  );\n  if (reservedHit !== undefined) {\n    throw new Error(\n      `Invalid dry-run stub file '${path}': contains the fixture key '${reservedHit}' — this is a fixture file; run it with 'workflow test'`\n    );\n  }\n  const result = dryRunStubsSchema.safeParse(parsed);\n  if (!result.success) {\n    const issues = result.error.issues\n      .map(issue => `${issue.path.join('.') || '<root>'}: ${issue.message}`)\n      .join('; ');\n    throw new Error(`Invalid dry-run stub file '${path}': ${issues}`);\n  }","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/workflows/src/dry-run.ts#L379-L415","documentation":"Thrown by loadDryRunStubs when the parsed YAML is not a single mapping of node ids to outputs — i.e. it is null, not an object, or an array. Stub files must be one flat YAML object; lists or scalar documents are rejected with this guidance message.","triggerScenarios":"Loading a stub file whose top-level document is an array, a scalar (string/number), an empty document (parses to null), or a fixture file in a list-like shape.","commonSituations":"Writing `- id: foo` list-style stubs instead of a mapping, saving an empty file (parses to null), or passing a test fixture file instead of a stub file.","solutions":["Reformat the file as one top-level YAML mapping: `nodeId: <output value>` per key.","Ensure the file is non-empty and not a bare list.","If you meant fixture-style input, run it through `workflow test` instead of the stub loader."],"exampleFix":"# before (list)\n- summarize: { text: hi }\n# after (mapping)\nsummarize:\n  text: hi","handlingStrategy":"type-guard","validationCode":"function isNonEmptyYamlMapping(text: string): boolean {\n  if (!text.trim()) return false;\n  try {\n    const v = Bun.YAML.parse(text);\n    return typeof v === \"object\" && v !== null && !Array.isArray(v);\n  } catch { return false; }\n}","typeGuard":"function isStubMapping(v: unknown): v is Record<string, unknown> {\n  return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}","tryCatchPattern":"try {\n  const stubs = await loadDryRunStubs(path);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"expected one YAML mapping of node ids to outputs\")) {\n    console.error(\"Stub file must be a top-level mapping `nodeId: output`:\", err.message);\n  } else throw err;\n}","preventionTips":["Always write stubs as `nodeId:` top-level keys, never list items.","Don't save empty stub files; delete them instead.","Keep fixture files and stub files in clearly named, separate locations.","Validate stub files after editing with a quick load call."],"tags":["dry-run","yaml","validation","stub"],"backgroundTag":"invalid-stub-file-format","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}