{"record":{"id":"c6d4fd57489b12be","repo":"caddyserver/caddy","slug":"getting-module-named-s-v","errorCode":null,"errorMessage":"getting module named '%s': %v","messagePattern":"getting module named '(.+?)': (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddyhttp/fileserver/command.go","lineNumber":139,"sourceCode":"\t\t\tPrefer: []string{\"zstd\", \"gzip\"},\n\t\t}, \"handler\", \"encode\", nil))\n\t}\n\n\tif templates {\n\t\thandler := caddytpl.Templates{FileRoot: root}\n\t\thandlers = append(handlers, caddyconfig.JSONModuleObject(handler, \"handler\", \"templates\", nil))\n\t}\n\n\thandler := FileServer{Root: root}\n\n\tif len(precompressed) != 0 {\n\t\t// logic mirrors modules/caddyhttp/fileserver/caddyfile.go case \"precompressed\"\n\t\tvar order []string\n\t\tfor _, compression := range precompressed {\n\t\t\tmodID := \"http.precompressed.\" + compression\n\t\t\tmod, err := caddy.GetModule(modID)\n\t\t\tif err != nil {\n\t\t\t\treturn caddy.ExitCodeFailedStartup, fmt.Errorf(\"getting module named '%s': %v\", modID, err)\n\t\t\t}\n\t\t\tinst := mod.New()\n\t\t\tprecompress, ok := inst.(encode.Precompressed)\n\t\t\tif !ok {\n\t\t\t\treturn caddy.ExitCodeFailedStartup, fmt.Errorf(\"module %s is not a precompressor; is %T\", modID, inst)\n\t\t\t}\n\t\t\tif handler.PrecompressedRaw == nil {\n\t\t\t\thandler.PrecompressedRaw = make(caddy.ModuleMap)\n\t\t\t}\n\t\t\thandler.PrecompressedRaw[compression] = caddyconfig.JSON(precompress, nil)\n\t\t\torder = append(order, compression)\n\t\t}\n\t\thandler.PrecompressedOrder = order\n\t}\n\n\tif browse {\n\t\thandler.Browse = &Browse{RevealSymlinks: revealSymlinks, FileLimit: fileLimit}\n\t}","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/fileserver/command.go#L121-L157","documentation":"`caddy file-server --precompressed X` startup error: no module with ID http.precompressed.X is registered. The module lookup fails because that precompression format is not compiled into the binary.","triggerScenarios":"--precompressed br on a standard build without the brotli precompress module; any typo like --precompressed gz (valid names are gzip, zstd in standard builds).","commonSituations":"Expecting brotli precompression without building the plugin; misspelled format names in scripts.","solutions":["Use only formats available in your build: check caddy list-modules | grep precompressed","Build with xcaddy adding the missing precompress module if one exists","Fix typos ('gzip' not 'gz', 'zstd' not 'zstandard')"],"exampleFix":"# before\ncaddy file-server --precompressed gz\n# after\ncaddy file-server --precompressed gzip","handlingStrategy":"validation","validationCode":"# verify each requested format has a module\nfor f in gzip zstd; do caddy list-modules | grep -q \"http.precompressed.$f\" || echo \"missing $f\"; done","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check caddy list-modules for precompressed formats before using them","Use exact names gzip/zstd (and plugin-provided ones)"],"tags":["caddy","cli","fileserver","modules","precompressed"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}