{"record":{"id":"7a90310700dbf415","repo":"kovidgoyal/kitty","slug":"unknown-network-type-v-in-socket-address-s","errorCode":null,"errorMessage":"Unknown network type: %#v in socket address: %s","messagePattern":"Unknown network type: %#v in socket address: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tools/utils/sockets.go","lineNumber":48,"sourceCode":"\t\t\tnetwork = \"ip\"\n\t\t}\n\t\treturn\n\t}\n\tif network == \"ip\" || network == \"ip6\" || network == \"ip4\" {\n\t\thost := ipaddr.NewHostName(addr)\n\t\tif !host.IsAddress() {\n\t\t\terr = fmt.Errorf(\"Not a valid IP address: %#v. Cannot use: %s\", addr, spec)\n\t\t}\n\t\treturn\n\t}\n\tif network == \"fd\" {\n\t\tfd := -1\n\t\tif fd, err = strconv.Atoi(addr); err != nil || fd < 0 {\n\t\t\terr = fmt.Errorf(\"Not a valid file descriptor number: %#v. Cannot use: %s\", addr, spec)\n\t\t}\n\t\treturn\n\t}\n\terr = fmt.Errorf(\"Unknown network type: %#v in socket address: %s\", network, spec)\n\treturn\n}\n","sourceCodeStart":30,"sourceCodeEnd":51,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/tools/utils/sockets.go#L30-L51","documentation":"ParseSocketAddress recognized networks are unix, tcp/tcp4/tcp6, ip/ip4/ip6, and fd. Anything else before the colon yields this unknown-network-type error — the spec had a colon, but the prefix is not a supported network.","triggerScenarios":"Specs like localhost:8080 (missing tcp: prefix, so network='localhost'), https:example.com, ws:..., or typos like tpc:127.0.0.1:80.","commonSituations":"Users omitting the tcp: prefix for network addresses — 'localhost:8080' is the classic case — or pasting URLs into a socket-address config field.","solutions":["Prefix with a supported network: tcp:localhost:8080.","Fix typos in the network name (unix, tcp, tcp4, tcp6, ip, ip4, ip6, fd).","Strip URL schemes (https://) before passing — this API takes socket specs, not URLs.","Add an allowlist validation check at config load time."],"exampleFix":"// before\nnet, addr, err := utils.ParseSocketAddress(\"localhost:8080\")\n// after\nnet, addr, err := utils.ParseSocketAddress(\"tcp:localhost:8080\")","handlingStrategy":"validation","validationCode":"var okNets = map[string]bool{\"unix\":true,\"tcp\":true,\"tcp4\":true,\"tcp6\":true,\"ip\":true,\"ip4\":true,\"ip6\":true,\"fd\":true}\nnet, _, _ := strings.Cut(spec, \":\")\nif !okNets[net] {\n    spec = \"tcp:\" + spec // common fix for missing prefix\n}","typeGuard":"func hasKnownNetwork(spec string) bool {\n    net, _, _ := strings.Cut(spec, \":\")\n    switch net {\n    case \"unix\", \"tcp\", \"tcp4\", \"tcp6\", \"ip\", \"ip4\", \"ip6\", \"fd\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"net, addr, err := utils.ParseSocketAddress(spec)\nif err != nil && strings.Contains(err.Error(), \"Unknown network type\") {\n    net, addr, err = utils.ParseSocketAddress(\"tcp:\" + spec)\n}","preventionTips":["Memorize the allowlist: unix, tcp/tcp4/tcp6, ip/ip4/ip6, fd.","Strip URL schemes before passing addresses.","Validate at config load with an allowlist map."],"tags":["go","sockets","address-parsing","configuration"],"backgroundTag":"invalid-socket-address","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}