{"record":{"id":"33002a1915a7521d","repo":"coleam00/Archon","slug":"failed-to-parse-dry-run-stub-file-path-er","errorCode":null,"errorMessage":"Failed to parse dry-run stub file '${path}': ${(error as Error).message}","messagePattern":"Failed to parse dry-run stub file '(.+?)': (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/workflows/src/dry-run.ts","lineNumber":393,"sourceCode":"   */\n  toleratedMissingStubs: z.array(z.string()),\n  unusedStubs: z.array(z.string()),\n  summary: z.string().optional(),\n});\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","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/workflows/src/dry-run.ts#L375-L411","documentation":"Thrown by loadDryRunStubs when Bun.YAML.parse throws while parsing the stub file's text. The original parser message is embedded so the developer sees the YAML syntax fault. This guards the boundary between a user-edited YAML file and the typed stub loader.","triggerScenarios":"Loading a stub file whose content is not valid YAML — tabs for indentation, unclosed quotes/brackets, or a file accidentally saved as JSON with invalid syntax.","commonSituations":"Hand-editing stubs.yaml and breaking indentation, editor inserting tabs, pasting JSON with trailing commas, or the file being truncated by a failed write.","solutions":["Fix the YAML syntax error reported in the embedded parser message (line/column usually included).","Replace tab indentation with spaces and close all quotes/brackets.","Validate the file with a YAML linter before loading."],"exampleFix":"# before (tab indentation)\nsummarize:\n\toutput: { text: hi }\n# after\nsummarize:\n  output: { text: hi }","handlingStrategy":"validation","validationCode":"import { parse } from \"yaml\";\nfunction stubFileIsWellFormedYaml(text: string): boolean {\n  try { parse(text); return true; } catch { return false; }\n}","typeGuard":"null","tryCatchPattern":"try {\n  const stubs = await loadDryRunStubs(path);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"Failed to parse dry-run stub file\")) {\n    console.error(\"YAML syntax error in stub file:\", err.message);\n    process.exitCode = 1;\n  } else throw err;\n}","preventionTips":["Use spaces, never tabs, in stub YAML.","Run a YAML linter as a pre-commit hook on stub files.","Edit stubs generated by the scaffold rather than writing them from scratch.","Verify file integrity after any scripted modification."],"tags":["dry-run","yaml","parse-error","stub"],"backgroundTag":"yaml-parse-error","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}