continuedev/continue · error · Error

Failed to parse block: ${formatZodError(e)}

Error message

Failed to parse block: ${formatZodError(e)}

What it means

parseBlock does YAML.parse + blockSchema.parse; any syntax or schema failure is rethrown with the Zod-formatted details prefixed 'Failed to parse block'.

Source

Thrown at packages/config-yaml/src/load/unroll.ts:79

  try {
    const parsed = YAML.parse(configYaml);
    const result = assistantUnrolledSchema.parse(parsed);
    return result;
  } catch (e: any) {
    console.error(
      `Failed to parse unrolled assistant: ${e.message}\n\n${configYaml}`,
    );
    throw new Error(`Failed to parse config: ${formatZodError(e)}`);
  }
}

export function parseBlock(configYaml: string): Block {
  try {
    const parsed = YAML.parse(configYaml);
    const result = blockSchema.parse(parsed);
    return result;
  } catch (e: any) {
    throw new Error(`Failed to parse block: ${formatZodError(e)}`);
  }
}

export const TEMPLATE_VAR_REGEX = /\${{[\s]*([^}\s]+)[\s]*}}/g;

export function getTemplateVariables(templatedYaml: string): string[] {
  // Defensive guard against undefined/null/non-string values
  if (!templatedYaml || typeof templatedYaml !== "string") {
    return [];
  }

  const variables = new Set<string>();
  const matches = templatedYaml.matchAll(TEMPLATE_VAR_REGEX);
  for (const match of matches) {
    variables.add(match[1]);
  }
  return Array.from(variables);
}

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Read the formatted issue paths in the message
  2. Validate block YAML structure against blockSchema docs/example blocks
  3. Run a YAML linter on the block file
Defensive patterns

Strategy: validation

Validate before calling

import { blockSchema } from '...';
const r = blockSchema.safeParse(YAML.parse(blockYaml));
if (!r.success) console.log(r.error.issues);

Try / catch

try { parseBlock(yaml); } catch (e) { if (e.message.startsWith('Failed to parse block:')) { /* show issues */ } }

Prevention

When it happens

Trigger: parseBlock('<invalid block yaml>') — wrong field types per blockSchema or syntactically broken YAML.

Common situations: Authoring a custom block with incorrect schema (missing name/inputs, wrong types), or editing a block file and breaking indentation.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/07b145156c07f972. Report an issue: GitHub.