{"record":{"id":"6772870f3e1d5b06","repo":"caddyserver/caddy","slug":"parsing-network-address-s-v","errorCode":null,"errorMessage":"parsing network address '%s': %v","messagePattern":"parsing network address '(.+?)': (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/logging/netwriter.go","lineNumber":69,"sourceCode":"// CaddyModule returns the Caddy module information.\nfunc (NetWriter) CaddyModule() caddy.ModuleInfo {\n\treturn caddy.ModuleInfo{\n\t\tID:  \"caddy.logging.writers.net\",\n\t\tNew: func() caddy.Module { return new(NetWriter) },\n\t}\n}\n\n// Provision sets up the module.\nfunc (nw *NetWriter) Provision(ctx caddy.Context) error {\n\trepl := caddy.NewReplacer()\n\taddress, err := repl.ReplaceOrErr(nw.Address, true, true)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid host in address: %v\", err)\n\t}\n\n\tnw.addr, err = caddy.ParseNetworkAddress(address)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing network address '%s': %v\", address, err)\n\t}\n\n\tif nw.addr.PortRangeSize() != 1 {\n\t\treturn fmt.Errorf(\"multiple ports not supported\")\n\t}\n\n\tif nw.DialTimeout < 0 {\n\t\treturn fmt.Errorf(\"timeout cannot be less than 0\")\n\t}\n\n\treturn nil\n}\n\nfunc (nw NetWriter) String() string {\n\treturn nw.addr.String()\n}\n\n// WriterKey returns a unique key representing this nw.","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/logging/netwriter.go#L51-L87","documentation":"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).","triggerScenarios":"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.","commonSituations":"Confusing URL syntax with Caddy network address syntax; omitting ports for services assumed to have defaults; placeholders that expand to a malformed string.","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"],"exampleFix":"# before\noutput net udp://syslog.local:514\n\n# after\noutput net udp/syslog.local:514","handlingStrategy":"validation","validationCode":"if _, err := caddy.ParseNetworkAddress(addr); err != nil {\n    return fmt.Errorf(\"bad net output address %q: %v\", addr, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use [tcp|udp|unix]/host:port syntax, never URL schemes like udp://","Always include an explicit port"],"tags":["caddy","logging","network","address-parsing"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}