caddyserver/caddy · error
unexpected type from 'servers' global options: %T
Error message
unexpected type from 'servers' global options: %T
What it means
Error "unexpected type from 'servers' global options: %T" thrown in caddyserver/caddy.
Source
Thrown at caddyconfig/httpcaddyfile/httptype.go:403
tkn := segment[0]
return nil, fmt.Errorf("%s:%d: unrecognized global option: %s", tkn.File, tkn.Line, opt)
}
val, err = optFunc(disp, options[opt])
if err != nil {
return nil, fmt.Errorf("parsing caddyfile tokens for '%s': %v", opt, err)
}
// As a special case, fold multiple "servers" options together
// in an array instead of overwriting a possible existing value
if opt == "servers" {
existingOpts, ok := options[opt].([]serverOptions)
if !ok {
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
}View on GitHub (pinned to 50e54ee279)
Solutions
- This is an internal type mismatch; report it with your Caddyfile. As a workaround, simplify or remove custom 'servers' global option parsing code.
When it happens
Trigger: Thrown at caddyconfig/httpcaddyfile/httptype.go:403 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/47b947a5d762be18.
Report an issue: GitHub.