{"record":{"id":"ee862142ca3e9e69","repo":"caddyserver/caddy","slug":"loading-wrapped-encoder-module-v","errorCode":null,"errorMessage":"loading wrapped encoder module: %v","messagePattern":"loading wrapped encoder module: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/logging/journaldencoder.go","lineNumber":79,"sourceCode":"\t}\n}\n\n// Provision sets up the encoder.\nfunc (je *JournaldEncoder) Provision(ctx caddy.Context) error {\n\tje.ctx = ctx\n\n\tif je.WrappedRaw == nil {\n\t\tje.Encoder = &JSONEncoder{}\n\t\tif p, ok := je.Encoder.(caddy.Provisioner); ok {\n\t\t\tif err := p.Provision(ctx); err != nil {\n\t\t\t\treturn fmt.Errorf(\"provisioning fallback encoder module: %v\", err)\n\t\t\t}\n\t\t}\n\t\tje.wrappedIsDefault = true\n\t} else {\n\t\tval, err := ctx.LoadModule(je, \"WrappedRaw\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"loading wrapped encoder module: %v\", err)\n\t\t}\n\t\tje.Encoder = val.(zapcore.Encoder)\n\t}\n\n\tsuppressConsoleEncoderTimestamp(je.Encoder)\n\n\treturn nil\n}\n\n// ConfigureDefaultFormat will set the default wrapped format to \"console\"\n// if the writer is a terminal. If already configured, it passes through\n// the writer so a deeply nested encoder can configure its own default format.\nfunc (je *JournaldEncoder) ConfigureDefaultFormat(wo caddy.WriterOpener) error {\n\tif !je.wrappedIsDefault {\n\t\tif cfd, ok := je.Encoder.(caddy.ConfiguresFormatterDefault); ok {\n\t\t\treturn cfd.ConfigureDefaultFormat(wo)\n\t\t}\n\t\treturn nil","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/logging/journaldencoder.go#L61-L97","documentation":"JournaldEncoder.Provision returns this when ctx.LoadModule(je, \"WrappedRaw\") fails to load the encoder configured inside the journald encoder's 'wrap' field. LoadModule errors mean the nested module name is not a registered encoder module ID, its JSON is malformed, or the module's own Provision/Validate failed.","triggerScenarios":"Config with format journald { format <name> } where <name> is not a valid caddy.logging.encoders.* module ID, or the nested module object fails its own provisioning.","commonSituations":"Typos in the nested format name (e.g. 'js' vs 'json', 'gelf' without the plugin installed); using an encoder provided by a plugin in a build that lacks that plugin; malformed nested JSON from API config pushes.","solutions":["Fix the nested encoder name to a registered encoder (json, console, filter, append, etc.)","If a plugin encoder is intended, rebuild/obtain a Caddy binary that includes that plugin","Check the wrapped error text from LoadModule for the precise module ID problem"],"exampleFix":"# before\nformat journald {\n    format gelf # plugin not in this build\n}\n\n# after\nformat journald {\n    format json\n}","handlingStrategy":"validation","validationCode":"known := map[string]bool{\"json\": true, \"console\": true, \"filter\": true, \"append\": true}\nif !known[nestedFormat] { return fmt.Errorf(\"unknown encoder %q\", nestedFormat) }","typeGuard":null,"tryCatchPattern":"if err := ctx.LoadModule(je, \"WrappedRaw\"); err != nil {\n    return fmt.Errorf(\"journald wrap: %w\", err) // inspect wrapped cause for bad module ID\n}","preventionTips":["Use encoder names from the caddy docs; verify plugin encoders exist in your build","Prefer Caddyfile syntax so the adapter catches unknown formats at adapt time"],"tags":["caddy","logging","journald","module-loading"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}