{"record":{"id":"6f86a118a026599b","repo":"continuedev/continue","slug":"failed-to-parse-config-formatzoderror-e","errorCode":null,"errorMessage":"Failed to parse config: ${formatZodError(e)}","messagePattern":"Failed to parse config: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/config-yaml/src/load/unroll.ts","lineNumber":51,"sourceCode":"  try {\n    const parsed = YAML.parse(configYaml);\n    const result = configYamlSchema.safeParse(parsed);\n    if (result.success) {\n      return result.data;\n    }\n\n    throw new Error(formatZodError(result.error), {\n      cause: \"result.success was false\",\n    });\n  } catch (e) {\n    if (\n      e instanceof Error &&\n      \"cause\" in e &&\n      e.cause === \"result.success was false\"\n    ) {\n      throw new Error(`Failed to parse config: ${e.message}`);\n    } else if (e instanceof ZodError) {\n      throw new Error(`Failed to parse config: ${formatZodError(e)}`);\n    } else {\n      throw new Error(\n        `Failed to parse config: ${e instanceof Error ? e.message : e}`,\n      );\n    }\n  }\n}\n\nexport function parseAssistantUnrolled(configYaml: string): AssistantUnrolled {\n  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)}`);","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/config-yaml/src/load/unroll.ts#L33-L69","documentation":"parseConfigYaml rethrows Zod validation failures with a human-formatted message (formatZodError) instead of raw Zod issues. The YAML parsed fine but did not match the config schema.","triggerScenarios":"parseConfigYaml on YAML that is syntactically valid but has wrong field names, wrong types, missing required fields, or unknown enum values per the Zod schema.","commonSituations":"Typos in config keys, using an outdated config format after a library upgrade, wrong nesting of blocks/models.","solutions":["Read the formatted message: it lists the exact failing paths and expected types","Fix the indicated fields in the YAML","Compare against a known-good example config for the current schema version"],"exampleFix":"// before\nmodel: gpt-4        # wrong shape\n# after\nmodel: openai/gpt-4  # matches expected provider/model format","handlingStrategy":"validation","validationCode":"// Dry-run schema validation for better UX\nimport { configSchema } from '...';\nconfigSchema.safeParse(YAML.parse(configYaml)); // inspect issues before parseConfigYaml","typeGuard":null,"tryCatchPattern":"try {\n  parseConfigYaml(yaml);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Failed to parse config:')) {\n    // show the formatted field paths to the user\n  }\n}","preventionTips":["Maintain example configs per schema version","Validate configs in CI with the schema","Read the formatted path list carefully before editing"],"tags":["zod","schema","validation","yaml"],"backgroundTag":"schema-validation-failed","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}