{"record":{"id":"2652d40d70e6e933","repo":"juicedata/juicefs","slug":"get-local-ip-s","errorCode":null,"errorMessage":"get local ip: %s","messagePattern":"get local ip: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/sync/cluster.go","lineNumber":329,"sourceCode":"\t\t\t}\n\t\t\tfor _, key := range r.FailedKeys {\n\t\t\t\tcheckpointMgr.MarkFailed(key)\n\t\t\t}\n\t\t}\n\t\tlogger.Debugf(\"receive stats %+v from %s\", r, req.RemoteAddr)\n\t\t_, _ = w.Write([]byte(\"OK\"))\n\t})\n\tvar addr string\n\tu, err := url.Parse(\"ssh://\" + config.Workers[0])\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"invalid worker address %s: %s\", config.Workers[0], err)\n\t}\n\tif config.ManagerAddr != \"\" {\n\t\taddr = config.ManagerAddr\n\t\tif strings.HasPrefix(addr, \":\") || strings.Contains(addr, \"0.0.0.0\") {\n\t\t\tip, err := utils.GetLocalIp(net.JoinHostPort(u.Host, \"22\"))\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"get local ip: %s\", err)\n\t\t\t}\n\t\t\taddr = ip + addr\n\t\t}\n\t} else {\n\t\tip, err := utils.GetLocalIp(net.JoinHostPort(u.Host, \"22\"))\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"not found local ip: %s\", err)\n\t\t}\n\t\tlogger.Debugf(\"Use local ip %s\", ip)\n\t\taddr = ip\n\t}\n\n\tif !strings.Contains(addr, \":\") {\n\t\taddr += \":\"\n\t}\n\n\tl, err := net.Listen(\"tcp\", addr)\n\tif err != nil {","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/sync/cluster.go#L311-L347","documentation":"When config.ManagerAddr is set and looks local (starts with ':' or contains '0.0.0.0'), startManager resolves the machine's outbound IP by dialing the first worker on port 22 via utils.GetLocalIp. This error wraps a failure of that resolution, so the manager cannot advertise a reachable address to workers.","triggerScenarios":"startManager runs with ManagerAddr like \":8080\" or \"0.0.0.0:8080\" and utils.GetLocalIp(\"workerhost:22\") fails — no route to the worker on port 22, DNS failure for the worker hostname, or no non-loopback interface available.","commonSituations":"Firewall blocks outbound port 22 to workers; worker hostname not resolvable from the manager; running in a container/network namespace without a routable interface; typo in worker address making the dial target unreachable.","solutions":["Set --manager-addr to a fully explicit reachable address (e.g. \"192.168.1.10:8080\") instead of \":8080\" so IP resolution is skipped","Verify the worker host is resolvable (DNS/hosts entry) and reachable on port 22 from the manager machine","Check that the machine has a non-loopback network interface with a route to the workers"],"exampleFix":"// before\n--manager-addr :8080\n// after\n--manager-addr 192.168.1.10:8080","handlingStrategy":"validation","validationCode":"// Ensure the manager address is explicit and routable\nif strings.HasPrefix(managerAddr, \":\") || strings.Contains(managerAddr, \"0.0.0.0\") {\n\tip, err := utils.GetLocalIp(workerHost + \":22\")\n\tif err != nil {\n\t\t// resolve/choose a concrete IP beforehand\n\t}\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a concrete --manager-addr (ip:port) instead of \":port\" on multi-host setups","Verify worker hostname resolves and port 22 is reachable from the manager","Ensure the manager host has a non-loopback interface with routes to workers"],"tags":["network","ip-resolution","distributed-sync"],"backgroundTag":"network-request-failed","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}