caddyserver/caddy · error
cannot have 'servers' global options with duplicate listener
Error message
cannot have 'servers' global options with duplicate listener addresses: %s
What it means
Error "cannot have 'servers' global options with duplicate listener addresses: %s" thrown in caddyserver/caddy.
Source
Thrown at caddyconfig/httpcaddyfile/httptype.go:450
}
options[opt] = append(existingOpts, defaultBindOpts...)
continue
}
options[opt] = val
}
// If we got "servers" options, we'll sort them by their listener address
if serverOpts, ok := options["servers"].([]serverOptions); ok {
sort.Slice(serverOpts, func(i, j int) bool {
return len(serverOpts[i].ListenerAddress) > len(serverOpts[j].ListenerAddress)
})
// Reject the config if there are duplicate listener address
seen := make(map[string]bool)
for _, entry := range serverOpts {
if _, alreadySeen := seen[entry.ListenerAddress]; alreadySeen {
return nil, fmt.Errorf("cannot have 'servers' global options with duplicate listener addresses: %s", entry.ListenerAddress)
}
seen[entry.ListenerAddress] = true
}
}
return serverBlocks[1:], nil
}
// extractNamedRoutes pulls out any named route server blocks
// so they don't get parsed as sites, and stores them in options
// for later.
func (ServerType) extractNamedRoutes(
serverBlocks []serverBlock,
options map[string]any,
warnings *[]caddyconfig.Warning,
replacer ShorthandReplacer,
) ([]serverBlock, error) {
namedRoutes := map[string]*caddyhttp.Route{}View on GitHub (pinned to 50e54ee279)
Solutions
- Remove the duplicate 'servers' global options block for that listener address, or merge the options into a single block.
When it happens
Trigger: Thrown at caddyconfig/httpcaddyfile/httptype.go:450 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/fdbea8c758ec6564.
Report an issue: GitHub.