caddyserver/caddy · error
loading wrapped encoder module: %v
Error message
loading wrapped encoder module: %v
What it means
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.
Source
Thrown at modules/logging/journaldencoder.go:79
}
}
// Provision sets up the encoder.
func (je *JournaldEncoder) Provision(ctx caddy.Context) error {
je.ctx = ctx
if je.WrappedRaw == nil {
je.Encoder = &JSONEncoder{}
if p, ok := je.Encoder.(caddy.Provisioner); ok {
if err := p.Provision(ctx); err != nil {
return fmt.Errorf("provisioning fallback encoder module: %v", err)
}
}
je.wrappedIsDefault = true
} else {
val, err := ctx.LoadModule(je, "WrappedRaw")
if err != nil {
return fmt.Errorf("loading wrapped encoder module: %v", err)
}
je.Encoder = val.(zapcore.Encoder)
}
suppressConsoleEncoderTimestamp(je.Encoder)
return nil
}
// ConfigureDefaultFormat will set the default wrapped format to "console"
// if the writer is a terminal. If already configured, it passes through
// the writer so a deeply nested encoder can configure its own default format.
func (je *JournaldEncoder) ConfigureDefaultFormat(wo caddy.WriterOpener) error {
if !je.wrappedIsDefault {
if cfd, ok := je.Encoder.(caddy.ConfiguresFormatterDefault); ok {
return cfd.ConfigureDefaultFormat(wo)
}
return nilView on GitHub (pinned to 50e54ee279)
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
Example fix
# before
format journald {
format gelf # plugin not in this build
}
# after
format journald {
format json
} Defensive patterns
Strategy: validation
Validate before calling
known := map[string]bool{"json": true, "console": true, "filter": true, "append": true}
if !known[nestedFormat] { return fmt.Errorf("unknown encoder %q", nestedFormat) } Try / catch
if err := ctx.LoadModule(je, "WrappedRaw"); err != nil {
return fmt.Errorf("journald wrap: %w", err) // inspect wrapped cause for bad module ID
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- provisioning fallback encoder module: %v
- server %s: logger name must not have a port: %s
- loading matcher modules: %v
- loading handler modules: %v
- loading storage module: %v
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/ee862142ca3e9e69.
Report an issue: GitHub.