continuedev/continue · error · Error
Failed to parse config: ${e instanceof Error ? e.message : e
Error message
Failed to parse config: ${e instanceof Error ? e.message : e} What it means
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.
Source
Thrown at packages/config-yaml/src/load/unroll.ts:53
const result = configYamlSchema.safeParse(parsed);
if (result.success) {
return result.data;
}
throw new Error(formatZodError(result.error), {
cause: "result.success was false",
});
} catch (e) {
if (
e instanceof Error &&
"cause" in e &&
e.cause === "result.success was false"
) {
throw new Error(`Failed to parse config: ${e.message}`);
} else if (e instanceof ZodError) {
throw new Error(`Failed to parse config: ${formatZodError(e)}`);
} else {
throw new Error(
`Failed to parse config: ${e instanceof Error ? e.message : e}`,
);
}
}
}
export function parseAssistantUnrolled(configYaml: string): AssistantUnrolled {
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)}`);
}
}View on GitHub (pinned to 5522c6f44c)
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
Defensive patterns
Strategy: try-catch
Validate before calling
// Sanitize input before parsing const clean = configYaml.replace(/^\uFEFF/, ''); // strip BOM
Try / catch
try {
parseConfigYaml(yaml);
} catch (e) {
if (e instanceof Error && e.message.startsWith('Failed to parse config:')) {
console.error('Raw cause:', e.message);
}
} Prevention
- Read files with utf8 and strip BOM
- Pre-parse with YAML.parse to isolate the failing layer
When it happens
Trigger: YAML.parse throwing an unexpected error type, or a non-Error value (string/undefined) being thrown during parsing/unrolling.
Common situations: BOM or encoding issues in the file, undefined being thrown from a custom parser hook, circular references in YAML anchors.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to parse config: ${e.message}
- Error parsing markdown frontmatter:
- Error in BedrockReranker.rerank: Unknown error occurred
- Invalid FQSN format: package slug must have two parts
- Failed to parse config: ${formatZodError(e)}
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/062e61c416620f45.
Report an issue: GitHub.