caddyserver/caddy · error
unexpected type from 'log' global options: %T
Error message
unexpected type from 'log' global options: %T
What it means
Type-assertion guard in evaluateGlobalOptionsBlock: the 'log' global option is expected to evaluate to []ConfigValue (folded across multiple 'log' entries). If the value registered by the option's handler has any other Go type, the assertion fails and this error is thrown. It indicates a bug in the global option's unmarshaler, not user input.
Solutions
- This is an internal type mismatch from the 'log' global option; check that any custom log option parser returns the expected type.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at caddyconfig/httpcaddyfile/httptype.go:417 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/f7ad5cbc41dd5c61.
Report an issue: GitHub.
Appendix: source
Thrown at caddyconfig/httpcaddyfile/httptype.go:417
existingOpts = []serverOptions{}
}
serverOpts, ok := val.(serverOptions)
if !ok {
return nil, fmt.Errorf("unexpected type from 'servers' global options: %T", val)
}
options[opt] = append(existingOpts, serverOpts)
continue
}
// Additionally, fold multiple "log" options together into an
// array so that multiple loggers can be configured.
if opt == "log" {
existingOpts, ok := options[opt].([]ConfigValue)
if !ok {
existingOpts = []ConfigValue{}
}
logOpts, ok := val.([]ConfigValue)
if !ok {
return nil, fmt.Errorf("unexpected type from 'log' global options: %T", val)
}
options[opt] = append(existingOpts, logOpts...)
continue
}
// Also fold multiple "default_bind" options together into an
// array so that server blocks can have multiple binds by default.
if opt == "default_bind" {
existingOpts, ok := options[opt].([]ConfigValue)
if !ok {
existingOpts = []ConfigValue{}
}
defaultBindOpts, ok := val.([]ConfigValue)
if !ok {
return nil, fmt.Errorf("unexpected type from 'default_bind' global options: %T", val)
}
options[opt] = append(existingOpts, defaultBindOpts...)
continue
}View on GitHub (pinned to 50e54ee279)