{"record":{"id":"329048b650b4d004","repo":"caddyserver/caddy","slug":"unsupported-network","errorCode":null,"errorMessage":"unsupported network","messagePattern":"unsupported network","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddyhttp/reverseproxy/httptransport.go","lineNumber":255,"sourceCode":"\t\t}\n\t\tif netaddr.PortRangeSize() > 1 {\n\t\t\treturn nil, fmt.Errorf(\"local_address must be a single address, not a port range\")\n\t\t}\n\t\tswitch netaddr.Network {\n\t\tcase \"tcp\", \"tcp4\", \"tcp6\":\n\t\t\tdialer.LocalAddr, err = net.ResolveTCPAddr(netaddr.Network, netaddr.JoinHostPort(0))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tcase \"unix\", \"unixgram\", \"unixpacket\":\n\t\t\tdialer.LocalAddr, err = net.ResolveUnixAddr(netaddr.Network, netaddr.JoinHostPort(0))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tcase \"udp\", \"udp4\", \"udp6\":\n\t\t\treturn nil, fmt.Errorf(\"local_address must be a TCP address, not a UDP address\")\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unsupported network\")\n\t\t}\n\t}\n\tif h.Resolver != nil {\n\t\terr := h.Resolver.ParseAddresses()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\td := &net.Dialer{\n\t\t\tTimeout:       time.Duration(h.DialTimeout),\n\t\t\tFallbackDelay: time.Duration(h.FallbackDelay),\n\t\t}\n\t\tdialer.Resolver = &net.Resolver{\n\t\t\tPreferGo: true,\n\t\t\tDial: func(ctx context.Context, _, _ string) (net.Conn, error) {\n\t\t\t\t//nolint:gosec\n\t\t\t\taddr := h.Resolver.netAddrs[weakrand.IntN(len(h.Resolver.netAddrs))]\n\t\t\t\treturn d.DialContext(ctx, addr.Network, addr.JoinHostPort(0))\n\t\t\t},","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/reverseproxy/httptransport.go#L237-L273","documentation":"The network of local_address fell through the switch on tcp/tcp4/tcp6, unix/unixgram/unixpacket, and udp/udp4/udp6 families. This happens when caddy.ParseNetworkAddressWithDefaults accepted an unusual network string that the transport cannot turn into a dialer LocalAddr.","triggerScenarios":"Specifying an exotic network in local_address such as `ip`, `ip4`, a custom registered net.Op, or an empty-but-present network string that still parses.","commonSituations":"Hand-crafted JSON configs (where there is no Caddyfile validation narrowing the values), or wrapping Caddy's address parser in custom tooling that passes through arbitrary network names.","solutions":["Use tcp (default), tcp4, tcp6, or a unix-family network in local_address","If you need raw IP sockets, do that in your own app — the HTTP transport only supports TCP/unix local addresses"],"exampleFix":"# before (JSON)\n{\"transport\": {\"protocol\": \"http\", \"local_address\": \"ip/10.0.0.5\"}}\n# after (JSON)\n{\"transport\": {\"protocol\": \"http\", \"local_address\": \"tcp/10.0.0.5\"}}","handlingStrategy":"validation","validationCode":"var okNets = map[string]bool{\"tcp\": true, \"tcp4\": true, \"tcp6\": true, \"unix\": true, \"unixgram\": true, \"unixpacket\": true}\nif !okNets[netaddr.Network] {\n\treturn fmt.Errorf(\"unsupported network %q\", netaddr.Network)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict config generators to the tcp/unix network set","Author in Caddyfile so the adapter normalizes networks"],"tags":["reverse-proxy","http-transport","network","validation"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}