juicedata/juicefs · error
are you connected to the network?
Error message
are you connected to the network?
What it means
The libjfs local IP discovery helper enumerates the host's network interfaces looking for an address matching a given mask, and returns "are you connected to the network?" when no usable address is found — i.e. no interface has an IP matching the mask (or no non-loopback IP exists at all).
Source
Thrown at sdk/java/libjfs/main.go:2120
case *net.IPNet:
ip = v.IP
case *net.IPAddr:
ip = v.IP
}
if ip == nil || ip.IsLoopback() {
continue
}
ip = ip.To4()
if ip == nil {
continue // not an ipv4 address
}
if !strings.HasPrefix(ip.String(), mask) {
continue
}
return ip.String(), nil
}
}
return "", errors.New("are you connected to the network?")
}
//export jfs_get_token
func jfs_get_token(h int64, cname *C.char, buf uintptr, count int32, renewer *C.char) int32 {
w := F(h)
if w == nil {
return EINVAL
}
id, t, eno := kerb.issue(w.ctx, w.Meta(), C.GoString(cname), w.user, C.GoString(renewer))
if eno != 0 {
logger.Errorf("get token for %s: %s", w.volname, eno)
return errno(eno)
}
wb := utils.NewNativeBuffer(toBuf(buf, count))
wb.Put32(id)
wb.Put64(uint64(t.Issued))
wb.Put64(uint64(t.Expire))
wb.Put([]byte(t.Password))View on GitHub (pinned to c9a67b23e8)
Solutions
- Verify the host has an up, non-loopback interface with an IP address (ip addr / ifconfig).
- Check the mask/prefix argument actually matches one of the host's subnets.
- Ensure containers have networking configured (docker run --network, CNI setup) before the lookup runs.
- If interfaces come up asynchronously, retry the lookup after a short delay.
Defensive patterns
Strategy: try-catch
Validate before calling
func hasUsableIP() bool {
ifaces, err := net.Interfaces()
if err != nil { return false }
for _, i := range ifaces {
if i.Flags&net.FlagUp == 0 || i.Flags&net.FlagLoopback != 0 { continue }
addrs, _ := i.Addrs()
if len(addrs) > 0 { return true }
}
return false
} Try / catch
ip, err := localIP(mask)
if err != nil {
log.Printf("no matching local IP for mask %s: %v; retrying", mask, err)
time.Sleep(time.Second)
ip, err = localIP(mask)
} Prevention
- Wait for network readiness (interface up) before IP discovery in containers/VMs
- Pass a mask that matches an actual host subnet; verify with `ip addr`
- Avoid running IP-dependent code in loopback-only namespaces
- Log all interface addresses when lookup fails to ease diagnosis
When it happens
Trigger: Calling the IP-lookup function on a host whose interfaces are all down or loopback-only; an interface whose IP does not match the supplied subnet mask; running inside a network namespace/container with no configured interfaces; IPv6-only environments where the mask comparison against IPv4 strings never matches.
Common situations: Containers or VMs started before the network is up, hosts with only a loopback device, sandboxed CI runners without network configuration, or a wrong subnet mask passed that matches no interface.
Related errors
- missing URL
- missing URL
- error GET request: %v
- Failed to create bucket %s: %s, previous error: %s
- failed to convert %s to %s: %w
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/df85f55809d11495.
Report an issue: GitHub.