{"record":{"id":"cd45c9f43820cb0d","repo":"kovidgoyal/kitty","slug":"abstract-unix-sockets-are-only-supported-on-linux","errorCode":null,"errorMessage":"Abstract UNIX sockets are only supported on Linux. Cannot use: %s","messagePattern":"Abstract UNIX sockets are only supported on Linux\\. Cannot use: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tools/utils/sockets.go","lineNumber":22,"sourceCode":"\nimport (\n\t\"fmt\"\n\t\"runtime\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/seancfoley/ipaddress-go/ipaddr\"\n)\n\nfunc ParseSocketAddress(spec string) (network string, addr string, err error) {\n\tnetwork, addr, found := strings.Cut(spec, \":\")\n\tif !found {\n\t\terr = fmt.Errorf(\"Invalid socket address: %s must be prefix by a protocol such as unix:\", spec)\n\t\treturn\n\t}\n\tif network == \"unix\" {\n\t\tif strings.HasPrefix(addr, \"@\") && runtime.GOOS != \"linux\" {\n\t\t\terr = fmt.Errorf(\"Abstract UNIX sockets are only supported on Linux. Cannot use: %s\", spec)\n\t\t}\n\t\treturn\n\t}\n\n\tif network == \"tcp\" || network == \"tcp6\" || network == \"tcp4\" {\n\t\thost := ipaddr.NewHostName(addr)\n\t\tif host.IsAddress() {\n\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}","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/tools/utils/sockets.go#L4-L40","documentation":"ParseSocketAddress accepts abstract (namespace-free) UNIX sockets written as unix:@name, where the leading '@' marks an abstract socket. These exist only on Linux; on macOS, Windows, or BSD the kernel has no abstract socket namespace, so the spec is rejected with this error.","triggerScenarios":"Using unix:@myapp-sock on any non-Linux platform (macOS, Windows, *BSD). Detected at option-parsing time in setup_global_options.","commonSituations":"Cross-platform config shared between Linux servers and Mac dev machines; configs copied from Linux systemd socket-activation setups.","solutions":["On non-Linux, use a filesystem path socket: unix:/tmp/myapp.sock.","Make the socket spec platform-conditional in config (runtime.GOOS check).","If abstract sockets are required, run the component on Linux only.","Use an env var override per platform for the listen address."],"exampleFix":"// before\nspec := \"unix:@myapp.sock\"\n// after\nspec := \"unix:@myapp.sock\"\nif runtime.GOOS != \"linux\" {\n    spec = \"unix:/tmp/myapp.sock\"\n}","handlingStrategy":"validation","validationCode":"spec := \"unix:@sock\"\nif strings.HasPrefix(spec[strings.Index(spec, \":\")+1:], \"@\") && runtime.GOOS != \"linux\" {\n    spec = \"unix:/tmp/sock\"\n}","typeGuard":"func socketSpecValidForOS(spec string) bool {\n    _, addr, _ := strings.Cut(spec, \":\")\n    return !(strings.HasPrefix(addr, \"@\") && runtime.GOOS != \"linux\")\n}","tryCatchPattern":"net, addr, err := utils.ParseSocketAddress(spec)\nif err != nil && strings.Contains(err.Error(), \"Abstract UNIX\") {\n    net, addr, err = utils.ParseSocketAddress(\"unix:/tmp/\" + name + \".sock\")\n}","preventionTips":["Make abstract-socket usage GOOS-conditional.","Use filesystem-path sockets in portable configs.","Gate abstract socket tests with runtime.GOOS == \"linux\"."],"tags":["go","sockets","unix","platform-specific"],"backgroundTag":"invalid-socket-address","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}