plandex-ai/plandex · error
failed to create glamour renderer: %w
Error message
failed to create glamour renderer: %w
What it means
getGlamourRenderer builds a glamour.TermRenderer for terminal markdown rendering and wraps any construction failure. glamour.NewTermRenderer fails mainly when the style name is invalid or style assets can't be loaded. Because package init() calls this, a bad GLAMOUR_STYLE env var can break the package at startup.
Source
Thrown at app/cli/term/format.go:50
var opts []glamour.TermRendererOption
// Check for a GLAMOUR_STYLE env variable.
if style, ok := os.LookupEnv("GLAMOUR_STYLE"); ok && style != "" {
opts = append(opts, glamour.WithStandardStyle(style))
} else {
// Fallback to auto style detection.
opts = append(opts, glamour.WithAutoStyle())
}
// Always set word wrap and preserved newlines.
opts = append(opts,
glamour.WithWordWrap(min(width, 80)),
glamour.WithPreservedNewLines(),
)
r, err := glamour.NewTermRenderer(opts...)
if err != nil {
return nil, fmt.Errorf("failed to create glamour renderer: %w", err)
}
cachedGlamourRenderer = r
cachedGlamourRendererWidth = width
return r, nil
}
func GetMarkdown(input string) (string, error) {
inputBytes := utils.RemoveFrontmatter([]byte(input))
r, err := getGlamourRenderer()
if err != nil {
return "", err
}
out, err := r.RenderBytes(inputBytes)
if err != nil {
return "", errView on GitHub (pinned to e2d772072e)
Solutions
- Check GLAMOUR_STYLE value; unset it or set it to a valid standard style (dark, light, notty, ascii)
- If using a custom style JSON, verify the file path exists and is valid JSON
- Run with GLAMOUR_STYLE unset to confirm auto-style works
- Update glamour to a version whose style set matches the configured name
Example fix
// before export GLAMOUR_STYLE=drak // after export GLAMOUR_STYLE=dark # or unset GLAMOUR_STYLE
Defensive patterns
Strategy: validation
Validate before calling
if style := os.Getenv("GLAMOUR_STYLE"); style != "" {
for _, valid := range []string{"dark","light","notty","ascii","dracula","nord","tokyo-night"} {
if style == valid { goto ok }
}
// unknown style: unset or fix GLAMOUR_STYLE before running
} Try / catch
r, err := getGlamourRenderer()
if err != nil {
// fallback: render plain text instead of failing
fmt.Println(input)
return nil
} Prevention
- Only set GLAMOUR_STYLE to documented standard styles or a valid style JSON file
- Sanitize shell profiles shared across machines for stale GLAMOUR_STYLE values
- Pin glamour versions and verify style names after upgrades
When it happens
Trigger: GLAMOUR_STYLE env var is set to an unknown style name (anything not dark/light/notty/ascii/dracula/etc. or a valid style JSON path), or the installed glamour version cannot load its style definitions.
Common situations: Developers set GLAMOUR_STYLE=drak (typo) or a custom style file path that doesn't exist; CI environments with a stale GLAMOUR_STYLE exported in shell profile; version upgrade changed valid style names.
Related errors
- error selecting account: %v
- failed to get confirmation user input: %s
- failed to open keyboard: %s
- failed to read keypress: %s
- error unmarshalling AZURE_DEPLOYMENTS_MAP: %w
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/5f7a2ba851033020.
Report an issue: GitHub.