caddyserver/caddy · error
parsing default browse template: %v
Error message
parsing default browse template: %v
What it means
The built-in BrowseTemplate constant (compiled into Caddy) failed to parse. This is not caused by user configuration — it indicates a corrupted or incompatible binary/embedded template, essentially an internal invariant failure.
Source
Thrown at modules/caddyhttp/fileserver/browse.go:329
listing.applySortAndLimit(sortParam, orderParam, limitParam, offsetParam)
}
// makeBrowseTemplate creates the template to be used for directory listings.
func (fsrv *FileServer) makeBrowseTemplate(tplCtx *templateContext) (*template.Template, error) {
var tpl *template.Template
var err error
if fsrv.Browse.TemplateFile != "" {
tpl = tplCtx.NewTemplate(path.Base(fsrv.Browse.TemplateFile))
tpl, err = tpl.ParseFiles(fsrv.Browse.TemplateFile)
if err != nil {
return nil, fmt.Errorf("parsing browse template file: %v", err)
}
} else {
tpl = tplCtx.NewTemplate("default_listing")
tpl, err = tpl.Parse(BrowseTemplate)
if err != nil {
return nil, fmt.Errorf("parsing default browse template: %v", err)
}
}
return tpl, nil
}
// isSymlink return true if f is a symbolic link.
func isSymlink(f fs.FileInfo) bool {
return f.Mode()&os.ModeSymlink != 0
}
// templateContext powers the context used when evaluating the browse template.
// It combines browse-specific features with the standard templates handler
// features.
type templateContext struct {
templates.TemplateContext
*browseTemplateContext
}View on GitHub (pinned to 50e54ee279)
Solutions
- If you patched BrowseTemplate, fix the template syntax to parse
- Otherwise use an official/stable Caddy build
Defensive patterns
Strategy: fallback
Prevention
- Don't patch the embedded BrowseTemplate without testing parse
- Use official builds unless you maintain a fork
When it happens
Trigger: Running a Caddy build whose source BrowseTemplate was modified into invalid template syntax; practically only hit by developers patching the embedded template string.
Common situations: Forks/patches of Caddy editing browse.go's template; binary-level corruption.
Related errors
- parsing browse template: %v
- parsing browse template file: %v
- the first option must be one of the following: %s, %s, %s, %
- the second option must be one of the following: %s, %s, but
- only max 2 sort options are allowed, but got %d
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/dd80ef670e7ab44d.
Report an issue: GitHub.