caddyserver/caddy · error
parsing network address '%s': %v
Error message
parsing network address '%s': %v
What it means
After placeholder substitution, NetWriter.Provision parses the address with caddy.ParseNetworkAddress and wraps failure with the offending address string. It means the address does not conform to Caddy's network address syntax [network/]host:port (e.g. missing port, bad scheme, empty host).
Source
Thrown at modules/logging/netwriter.go:69
// CaddyModule returns the Caddy module information.
func (NetWriter) CaddyModule() caddy.ModuleInfo {
return caddy.ModuleInfo{
ID: "caddy.logging.writers.net",
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.View on GitHub (pinned to 50e54ee279)
Solutions
- Use Caddy address syntax: [tcp|udp|unix]/host:port, e.g. 'udp/logs.example.com:514'
- Ensure a port is present — there is no default
- Re-run 'caddy validate' and read the echoed address in the message to see what the placeholder expanded to
Example fix
# before output net udp://syslog.local:514 # after output net udp/syslog.local:514
Defensive patterns
Strategy: validation
Validate before calling
if _, err := caddy.ParseNetworkAddress(addr); err != nil {
return fmt.Errorf("bad net output address %q: %v", addr, err)
} Prevention
- Use [tcp|udp|unix]/host:port syntax, never URL schemes like udp://
- Always include an explicit port
When it happens
Trigger: output net with a value like 'syslog' (no port), 'udp://host:514' (wrong scheme style — should be 'udp/host:514'), or 'tcp/localhost' without a port.
Common situations: Confusing URL syntax with Caddy network address syntax; omitting ports for services assumed to have defaults; placeholders that expand to a malformed string.
Related errors
- invalid host in address: %v
- multiple ports not supported
- timeout cannot be less than 0
- download failed: %v
- server %s: logger name must not have a port: %s
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/6772870f3e1d5b06.
Report an issue: GitHub.