{"record":{"id":"2d4a1239739efaa8","repo":"caddyserver/caddy","slug":"module-s-is-not-a-precompressor-is-t","errorCode":null,"errorMessage":"module %s is not a precompressor; is %T","messagePattern":"module (.+?) is not a precompressor; is %T","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddyhttp/fileserver/command.go","lineNumber":144,"sourceCode":"\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}\n\n\thandlers = append(handlers, caddyconfig.JSONModuleObject(handler, \"handler\", \"file_server\", nil))\n\n\troute := caddyhttp.Route{HandlersRaw: handlers}\n","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/fileserver/command.go#L126-L162","documentation":"`caddy file-server --precompressed X` startup error: the module http.precompressed.X exists but its instance does not implement encode.Precompressed. The message reports the concrete Go type of the instance. This guards against a module squatting the precompressed namespace without the required interface.","triggerScenarios":"A third-party module registers itself under http.precompressed.<name> but its New() returns a type lacking the Precompressed interface (Encode()/AcceptEncoding()-style methods).","commonSituations":"Custom/xcaddy plugins misusing the http.precompressed namespace; version mismatches where the plugin targets an older Caddy API.","solutions":["Check the reported type — if it's your plugin, implement encode.Precompressed properly","Remove or update the offending plugin in the xcaddy build","Use only well-maintained precompressor plugins"],"exampleFix":"// plugin must satisfy the interface\nvar _ encode.Precompressed = (*MyPrecompress)(nil)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// plugin compile-time interface guard\nvar _ encode.Precompressed = (*MyPrecompress)(nil)","tryCatchPattern":null,"preventionTips":["Only register modules under http.precompressed if they implement encode.Precompressed","Keep plugins updated with the Caddy API version you build against"],"tags":["caddy","cli","fileserver","plugin","interface"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}