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

  1. If you patched BrowseTemplate, fix the template syntax to parse
  2. Otherwise use an official/stable Caddy build
Defensive patterns

Strategy: fallback

Prevention

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


AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15). Data as JSON: /api/errors/dd80ef670e7ab44d. Report an issue: GitHub.