{"record":{"id":"07b145156c07f972","repo":"continuedev/continue","slug":"failed-to-parse-block-formatzoderror-e","errorCode":null,"errorMessage":"Failed to parse block: ${formatZodError(e)}","messagePattern":"Failed to parse block: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/config-yaml/src/load/unroll.ts","lineNumber":79,"sourceCode":"  try {\n    const parsed = YAML.parse(configYaml);\n    const result = assistantUnrolledSchema.parse(parsed);\n    return result;\n  } catch (e: any) {\n    console.error(\n      `Failed to parse unrolled assistant: ${e.message}\\n\\n${configYaml}`,\n    );\n    throw new Error(`Failed to parse config: ${formatZodError(e)}`);\n  }\n}\n\nexport function parseBlock(configYaml: string): Block {\n  try {\n    const parsed = YAML.parse(configYaml);\n    const result = blockSchema.parse(parsed);\n    return result;\n  } catch (e: any) {\n    throw new Error(`Failed to parse block: ${formatZodError(e)}`);\n  }\n}\n\nexport const TEMPLATE_VAR_REGEX = /\\${{[\\s]*([^}\\s]+)[\\s]*}}/g;\n\nexport function getTemplateVariables(templatedYaml: string): string[] {\n  // Defensive guard against undefined/null/non-string values\n  if (!templatedYaml || typeof templatedYaml !== \"string\") {\n    return [];\n  }\n\n  const variables = new Set<string>();\n  const matches = templatedYaml.matchAll(TEMPLATE_VAR_REGEX);\n  for (const match of matches) {\n    variables.add(match[1]);\n  }\n  return Array.from(variables);\n}","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/config-yaml/src/load/unroll.ts#L61-L97","documentation":"parseBlock does YAML.parse + blockSchema.parse; any syntax or schema failure is rethrown with the Zod-formatted details prefixed 'Failed to parse block'.","triggerScenarios":"parseBlock('<invalid block yaml>') — wrong field types per blockSchema or syntactically broken YAML.","commonSituations":"Authoring a custom block with incorrect schema (missing name/inputs, wrong types), or editing a block file and breaking indentation.","solutions":["Read the formatted issue paths in the message","Validate block YAML structure against blockSchema docs/example blocks","Run a YAML linter on the block file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { blockSchema } from '...';\nconst r = blockSchema.safeParse(YAML.parse(blockYaml));\nif (!r.success) console.log(r.error.issues);","typeGuard":null,"tryCatchPattern":"try { parseBlock(yaml); } catch (e) { if (e.message.startsWith('Failed to parse block:')) { /* show issues */ } }","preventionTips":["Author blocks from a known-good template","Lint block YAML in CI"],"tags":["block","zod","yaml","validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}