juicedata/juicefs · error
listen: %s
Error message
listen: %s
What it means
After computing the listen address, startManager calls net.Listen("tcp", addr). This error wraps a listener creation failure, meaning the manager could not bind the TCP port — typically because the port is already in use, the address is not assignable to any interface, or permission is denied for privileged ports.
Source
Thrown at pkg/sync/cluster.go:348
}
addr = ip + addr
}
} else {
ip, err := utils.GetLocalIp(net.JoinHostPort(u.Host, "22"))
if err != nil {
return "", fmt.Errorf("not found local ip: %s", err)
}
logger.Debugf("Use local ip %s", ip)
addr = ip
}
if !strings.Contains(addr, ":") {
addr += ":"
}
l, err := net.Listen("tcp", addr)
if err != nil {
return "", fmt.Errorf("listen: %s", err)
}
logger.Infof("Listen at %s", l.Addr())
go func() { _ = http.Serve(l, mux) }()
return l.Addr().String(), nil
}
func findSelfPath() (string, error) {
program := os.Args[0]
if strings.Contains(program, "/") {
path, err := filepath.Abs(program)
if err != nil {
return "", fmt.Errorf("resolve path %s: %s", program, err)
}
return path, nil
}
for _, searchPath := range strings.Split(os.Getenv("PATH"), ":") {
if searchPath != "" {
p := filepath.Join(searchPath, program)View on GitHub (pinned to c9a67b23e8)
Solutions
- Free the port: find and stop the process holding it (ss -ltnp / lsof -i :PORT) or pick a different --manager-addr port
- Use a port >1024 or run with appropriate privileges if binding a privileged port
- Make sure the IP in --manager-addr exists on the manager host (use 0.0.0.0 or the correct interface IP)
Example fix
// before --manager-addr 10.0.0.5:8080 # port taken // after --manager-addr 10.0.0.5:18080
Defensive patterns
Strategy: validation
Validate before calling
// Check port availability before starting the manager
if l, err := net.Listen("tcp", addr); err != nil {
return fmt.Errorf("port %s unavailable: %w", addr, err)
} else {
l.Close()
} Prevention
- Pick a free, high (>1024) port for --manager-addr
- Check for stale manager processes before restarting sync (ss -ltnp)
- Bind to an IP that actually exists on the manager host, or 0.0.0.0
When it happens
Trigger: startManager binds the resolved addr and net.Listen fails: another process holds the port (address already in use), binding to an IP not present on the host, using a privileged port (<1024) as non-root, or port range exhausted.
Common situations: Previous sync manager still running and holding the port; --manager-addr pointing to the wrong host IP; using port 80/443 without root; docker/k8s port conflicts.
Related errors
- are you connected to the network?
- error GET request: %v
- Failed to create bucket %s: %s, previous error: %s
- failed to convert %s to %s: %w
- (cancelled) upload block %s: %s (after %d tries)
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/04e5f02e56b9f653.
Report an issue: GitHub.