kovidgoyal/kitty · error
Unknown network type: %#v in socket address: %s
Error message
Unknown network type: %#v in socket address: %s
What it means
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.
Source
Thrown at tools/utils/sockets.go:48
network = "ip"
}
return
}
if network == "ip" || network == "ip6" || network == "ip4" {
host := ipaddr.NewHostName(addr)
if !host.IsAddress() {
err = fmt.Errorf("Not a valid IP address: %#v. Cannot use: %s", addr, spec)
}
return
}
if network == "fd" {
fd := -1
if fd, err = strconv.Atoi(addr); err != nil || fd < 0 {
err = fmt.Errorf("Not a valid file descriptor number: %#v. Cannot use: %s", addr, spec)
}
return
}
err = fmt.Errorf("Unknown network type: %#v in socket address: %s", network, spec)
return
}
View on GitHub (pinned to 6d5d0c4406)
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.
Example fix
// before
net, addr, err := utils.ParseSocketAddress("localhost:8080")
// after
net, addr, err := utils.ParseSocketAddress("tcp:localhost:8080") Defensive patterns
Strategy: validation
Validate before calling
var okNets = map[string]bool{"unix":true,"tcp":true,"tcp4":true,"tcp6":true,"ip":true,"ip4":true,"ip6":true,"fd":true}
net, _, _ := strings.Cut(spec, ":")
if !okNets[net] {
spec = "tcp:" + spec // common fix for missing prefix
} Type guard
func hasKnownNetwork(spec string) bool {
net, _, _ := strings.Cut(spec, ":")
switch net {
case "unix", "tcp", "tcp4", "tcp6", "ip", "ip4", "ip6", "fd":
return true
}
return false
} Try / catch
net, addr, err := utils.ParseSocketAddress(spec)
if err != nil && strings.Contains(err.Error(), "Unknown network type") {
net, addr, err = utils.ParseSocketAddress("tcp:" + spec)
} Prevention
- 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.
When it happens
Trigger: Specs like localhost:8080 (missing tcp: prefix, so network='localhost'), https:example.com, ws:..., or typos like tpc:127.0.0.1:80.
Common situations: Users omitting the tcp: prefix for network addresses — 'localhost:8080' is the classic case — or pasting URLs into a socket-address config field.
Related errors
- Invalid socket address: %s must be prefix by a protocol such
- Invalid listen-on value: {spec} must be of the form protocol
- Abstract UNIX sockets are only supported on Linux. Cannot us
- Not a valid IP address: %#v. Cannot use: %s
- Not a valid file descriptor number: %#v. Cannot use: %s
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/7a90310700dbf415.
Report an issue: GitHub.