{"record":{"id":"dd80ef670e7ab44d","repo":"caddyserver/caddy","slug":"parsing-default-browse-template-v","errorCode":null,"errorMessage":"parsing default browse template: %v","messagePattern":"parsing default browse template: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"modules/caddyhttp/fileserver/browse.go","lineNumber":329,"sourceCode":"\tlisting.applySortAndLimit(sortParam, orderParam, limitParam, offsetParam)\n}\n\n// makeBrowseTemplate creates the template to be used for directory listings.\nfunc (fsrv *FileServer) makeBrowseTemplate(tplCtx *templateContext) (*template.Template, error) {\n\tvar tpl *template.Template\n\tvar err error\n\n\tif fsrv.Browse.TemplateFile != \"\" {\n\t\ttpl = tplCtx.NewTemplate(path.Base(fsrv.Browse.TemplateFile))\n\t\ttpl, err = tpl.ParseFiles(fsrv.Browse.TemplateFile)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parsing browse template file: %v\", err)\n\t\t}\n\t} else {\n\t\ttpl = tplCtx.NewTemplate(\"default_listing\")\n\t\ttpl, err = tpl.Parse(BrowseTemplate)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parsing default browse template: %v\", err)\n\t\t}\n\t}\n\n\treturn tpl, nil\n}\n\n// isSymlink return true if f is a symbolic link.\nfunc isSymlink(f fs.FileInfo) bool {\n\treturn f.Mode()&os.ModeSymlink != 0\n}\n\n// templateContext powers the context used when evaluating the browse template.\n// It combines browse-specific features with the standard templates handler\n// features.\ntype templateContext struct {\n\ttemplates.TemplateContext\n\t*browseTemplateContext\n}","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/fileserver/browse.go#L311-L347","documentation":"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.","triggerScenarios":"Running a Caddy build whose source BrowseTemplate was modified into invalid template syntax; practically only hit by developers patching the embedded template string.","commonSituations":"Forks/patches of Caddy editing browse.go's template; binary-level corruption.","solutions":["If you patched BrowseTemplate, fix the template syntax to parse","Otherwise use an official/stable Caddy build"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't patch the embedded BrowseTemplate without testing parse","Use official builds unless you maintain a fork"],"tags":["caddy","fileserver","browse","template","internal"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}