{"record":{"id":"062e61c416620f45","repo":"continuedev/continue","slug":"failed-to-parse-config-e-instanceof-error-e-m","errorCode":null,"errorMessage":"Failed to parse config: ${e instanceof Error ? e.message : e}","messagePattern":"Failed to parse config: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/config-yaml/src/load/unroll.ts","lineNumber":53,"sourceCode":"    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)}`);\n  }\n}","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/config-yaml/src/load/unroll.ts#L35-L71","documentation":"Catch-all branch of parseConfigYaml: the YAML string threw something that is neither the internal success:false error nor a ZodError (could be a non-Error throw). The message stringifies whatever was thrown.","triggerScenarios":"YAML.parse throwing an unexpected error type, or a non-Error value (string/undefined) being thrown during parsing/unrolling.","commonSituations":"BOM or encoding issues in the file, undefined being thrown from a custom parser hook, circular references in YAML anchors.","solutions":["Log the full stringified throw value for identification","Ensure the input is a clean UTF-8 string (strip BOM)","Reproduce with YAML.parse directly to isolate whether the fault is in the YAML library or this wrapper"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Sanitize input before parsing\nconst clean = configYaml.replace(/^\\uFEFF/, ''); // strip BOM","typeGuard":null,"tryCatchPattern":"try {\n  parseConfigYaml(yaml);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Failed to parse config:')) {\n    console.error('Raw cause:', e.message);\n  }\n}","preventionTips":["Read files with utf8 and strip BOM","Pre-parse with YAML.parse to isolate the failing layer"],"tags":["yaml","parsing","unknown-error"],"backgroundTag":"yaml-parse-failed","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}