{"record":{"id":"3dd2d8b36fe38a7f","repo":"caddyserver/caddy","slug":"unsupported-network-type-s","errorCode":null,"errorMessage":"unsupported network type: %s","messagePattern":"unsupported network type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"listeners.go","lineNumber":191,"sourceCode":"\t} else {\n\t\tif na.IsUnixNetwork() {\n\t\t\t// if this is a unix socket, see if we already have it open\n\t\t\tln, err = reuseUnixSocket(na.Network, address)\n\t\t}\n\n\t\tif ln == nil && err == nil {\n\t\t\t// otherwise, create a new listener\n\t\t\tlnKey := listenerKey(na.Network, address)\n\t\t\tln, err = listenReusable(ctx, lnKey, na.Network, address, config)\n\t\t}\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif ln == nil {\n\t\treturn nil, fmt.Errorf(\"unsupported network type: %s\", na.Network)\n\t}\n\n\tif IsUnixNetwork(na.Network) {\n\t\tisAbstractUnixSocket := strings.HasPrefix(address, \"@\")\n\t\tif !isAbstractUnixSocket {\n\t\t\terr = os.Chmod(address, unixFileMode)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unable to set permissions (%s) on %s: %v\", unixFileMode, address, err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ln, nil\n}\n\n// IsUnixNetwork returns true if na.Network is\n// unix, unixgram, or unixpacket.\nfunc (na NetworkAddress) IsUnixNetwork() bool {","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/listeners.go#L173-L209","documentation":"In Listen piece assembly, after all registered listener-creation paths run, if err is nil but no listener object was produced, the network type is unsupported. Caddy supports tcp/tcp4/tcp6, udp/udp4/udp6, unix/unixpacket/unixgram, fd/fdgram; anything else falls through with ln == nil.","triggerScenarios":"Calling caddy.Listen with a NetworkAddress whose Network is misspelled or unsupported: 'tpc', 'http', 'ip', 'socket', or an empty network that slipped through earlier validation.","commonSituations":"Typos in the listen network in JSON config or API calls; custom code calling caddy.Listen with arbitrary net package networks (ip, ip4) that Caddy deliberately does not handle.","solutions":["Use one of the supported networks: tcp, tcp4, tcp6, udp, udp4, udp6, unix, unixpacket, unixgram, fd, fdgram.","For plain HTTP words in the address (http://), remove them — Caddy parses host:port, not schemes, in listen addresses.","If you truly need another net package network, dial/listen directly with net.Listen rather than Caddy's listener pool."],"exampleFix":"// before\naddr, _ := caddy.ParseNetworkAddress(\"tpc://:80\")\nln, err := addr.Listen(ctx)\n// after\naddr, _ := caddy.ParseNetworkAddress(\"tcp/:80\")\nln, err := addr.Listen(ctx)","handlingStrategy":"type-guard","validationCode":"var supportedNetworks = map[string]bool{\n    \"tcp\": true, \"tcp4\": true, \"tcp6\": true,\n    \"udp\": true, \"udp4\": true, \"udp6\": true,\n    \"unix\": true, \"unixpacket\": true, \"unixgram\": true,\n    \"fd\": true, \"fdgram\": true,\n}\n\nfunc networkOK(n string) bool { return supportedNetworks[n] }","typeGuard":"func isSupportedNetwork(n string) bool {\n    switch n {\n    case \"tcp\", \"tcp4\", \"tcp6\", \"udp\", \"udp4\", \"udp6\",\n         \"unix\", \"unixpacket\", \"unixgram\", \"fd\", \"fdgram\":\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Validate networks against the supported set in config linters.","Prefer ParseNetworkAddress early so bad networks fail at parse time with clear errors."],"tags":["listen","network","validation","config"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}