coleam00/Archon · error · Error
Failed to parse dry-run stub file '${path}': ${(error as Err
Error message
Failed to parse dry-run stub file '${path}': ${(error as Error).message} What it means
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.
Source
Thrown at packages/workflows/src/dry-run.ts:393
*/
toleratedMissingStubs: z.array(z.string()),
unusedStubs: z.array(z.string()),
summary: z.string().optional(),
});
export type DryRunResult = z.infer<typeof dryRunResultSchema>;
export async function loadDryRunStubs(path?: string): Promise<DryRunStubs> {
if (!path) return {};
const file = Bun.file(path);
if (!(await file.exists())) {
throw new Error(`Dry-run stub file not found: ${path}`);
}
let parsed: unknown;
try {
parsed = Bun.YAML.parse(await file.text());
} catch (error) {
throw new Error(`Failed to parse dry-run stub file '${path}': ${(error as Error).message}`);
}
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
throw new Error(
`Invalid dry-run stub file '${path}': expected one YAML mapping of node ids to outputs`
);
}
const reservedHit = Object.keys(parsed as Record<string, unknown>).find(key =>
RESERVED_FIXTURE_KEYS.has(key)
);
if (reservedHit !== undefined) {
throw new Error(
`Invalid dry-run stub file '${path}': contains the fixture key '${reservedHit}' — this is a fixture file; run it with 'workflow test'`
);
}
const result = dryRunStubsSchema.safeParse(parsed);
if (!result.success) {
const issues = result.error.issuesView on GitHub (pinned to 0773b97458)
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.
Example fix
# before (tab indentation)
summarize:
output: { text: hi }
# after
summarize:
output: { text: hi } Defensive patterns
Strategy: validation
Validate before calling
import { parse } from "yaml";
function stubFileIsWellFormedYaml(text: string): boolean {
try { parse(text); return true; } catch { return false; }
} Type guard
null
Try / catch
try {
const stubs = await loadDryRunStubs(path);
} catch (err) {
if (err instanceof Error && err.message.startsWith("Failed to parse dry-run stub file")) {
console.error("YAML syntax error in stub file:", err.message);
process.exitCode = 1;
} else throw err;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Hand-editing stubs.yaml and breaking indentation, editor inserting tabs, pasting JSON with trailing commas, or the file being truncated by a failed write.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Invalid dry-run stub file '${path}': expected one YAML mappi
- Invalid YAML in run config '${path}': ${(error as Error).mes
- Cannot generate dry-run scaffold: nodes sharing stub key '${
- EEXIST
- Dry-run stub file not found: ${path}
AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01).
Data as JSON: /api/errors/33002a1915a7521d.
Report an issue: GitHub.