caddyserver/caddy · error
multiple ports not supported
Error message
multiple ports not supported
What it means
NetWriter opens exactly one connection, so Provision rejects addresses whose PortRangeSize() != 1. A port range like 'tcp/host:5000-5010' spans multiple ports and cannot map to a single dial target for a log writer.
Source
Thrown at modules/logging/netwriter.go:73
New: func() caddy.Module { return new(NetWriter) },
}
}
// Provision sets up the module.
func (nw *NetWriter) Provision(ctx caddy.Context) error {
repl := caddy.NewReplacer()
address, err := repl.ReplaceOrErr(nw.Address, true, true)
if err != nil {
return fmt.Errorf("invalid host in address: %v", err)
}
nw.addr, err = caddy.ParseNetworkAddress(address)
if err != nil {
return fmt.Errorf("parsing network address '%s': %v", address, err)
}
if nw.addr.PortRangeSize() != 1 {
return fmt.Errorf("multiple ports not supported")
}
if nw.DialTimeout < 0 {
return fmt.Errorf("timeout cannot be less than 0")
}
return nil
}
func (nw NetWriter) String() string {
return nw.addr.String()
}
// WriterKey returns a unique key representing this nw.
func (nw NetWriter) WriterKey() string {
return nw.addr.String()
}
View on GitHub (pinned to 50e54ee279)
Solutions
- Change the address to a single port, e.g. 'tcp/logs.example.com:2000'
- If you need multiple destinations, configure several log outputs or a relay instead of a range
Example fix
# before output net tcp/logs.example.com:2000-2010 # after output net tcp/logs.example.com:2000
Defensive patterns
Strategy: validation
Validate before calling
if a, err := caddy.ParseNetworkAddress(addr); err == nil && a.PortRangeSize() != 1 {
return fmt.Errorf("net output requires a single port, got range %s", a.String())
} Prevention
- Remember output addresses accept one port only, unlike site addresses
- Lint configs for hyphenated ports in output lines
When it happens
Trigger: Configuring output net with a port range, e.g. 'net tcp/logs.example.com:2000-2010' or a placeholder expanding to a range.
Common situations: Copy-pasting listener address syntax (where ranges are legal) into an output address; templated configs that append ':1000-1010'.
Related errors
- invalid host in address: %v
- parsing network address '%s': %v
- timeout cannot be less than 0
- must be exactly one listener address; cannot listen on: %s
- download failed: %v
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/3faae39a5fc387f6.
Report an issue: GitHub.