{"record":{"id":"4ed45294f3a31142","repo":"coleam00/Archon","slug":"dry-run-stub-file-not-found-path","errorCode":null,"errorMessage":"Dry-run stub file not found: ${path}","messagePattern":"Dry-run stub file not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/workflows/src/dry-run.ts","lineNumber":386,"sourceCode":"  missingStubs: z.array(z.string()),\n  /**\n   * The subset of `missingStubs` a `trigger_rule: all_done` join tolerated (#2869) —\n   * hydrated with a generated placeholder rather than failing the node. Always a\n   * subset of `missingStubs`, never a replacement for it: a consumer that only cares\n   * about genuinely blocking gaps filters `missingStubs` by this list; one that wants\n   * every unverified node (the pre-#2869 contract) keeps reading `missingStubs` alone.\n   */\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) {","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/workflows/src/dry-run.ts#L368-L404","documentation":"Thrown by loadDryRunStubs when a stub file path is supplied but Bun's file.exists() reports the file is missing. The loader requires an explicit, existing file; it does not silently return empty stubs for a bad path.","triggerScenarios":"Calling loadDryRunStubs(path) — directly or via stubs/result/loaded entry points — where `path` points to a nonexistent or deleted file, or a typo'd/relative path resolved from the wrong working directory.","commonSituations":"Passing `--stubs stubs.yaml` from a different working directory, forgetting to run the scaffold step first, deleting the stub during cleanup scripts, or a renamed stub file.","solutions":["Verify the path exists (ls the file) and run the command from the directory containing it, or pass an absolute path.","Generate the stub file first via the dry-run scaffold if it was never created.","Omit the stub path argument if no stubs are needed (loader returns {})."],"exampleFix":"// before\nconst stubs = await loadDryRunStubs(\"./stubs.yaml\"); // CWD is elsewhere\n// after\nconst stubs = await loadDryRunStubs(\"/abs/path/to/stubs.yaml\");","handlingStrategy":"validation","validationCode":"import { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nfunction stubFileReady(path?: string): boolean {\n  if (!path) return true;\n  return existsSync(resolve(process.cwd(), path));\n}","typeGuard":"null","tryCatchPattern":"try {\n  const stubs = await loadDryRunStubs(path);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"Dry-run stub file not found\")) {\n    console.warn(`No stub file at ${path}; continuing with empty stubs.`);\n    return {};\n  }\n  throw err;\n}","preventionTips":["Pass absolute paths or resolve relative to a known base directory.","Run the scaffold step before any stub-consuming command.","Check file existence in shell scripts before invoking the loader.","Don't clean up stub files mid-pipeline."],"tags":["dry-run","filesystem","file-not-found","stub"],"backgroundTag":"file-not-found","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}