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.issues

View on GitHub (pinned to 0773b97458)

Solutions

  1. Fix the YAML syntax error reported in the embedded parser message (line/column usually included).
  2. Replace tab indentation with spaces and close all quotes/brackets.
  3. 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

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

Related errors


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