{"record":{"id":"aa8a92d0795f219c","repo":"abiosoft/colima","slug":"no-ip-address-assigned-to-network-interface","errorCode":null,"errorMessage":"no IP address assigned to network interface","messagePattern":"no IP address assigned to network interface","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"environment/container/kubernetes/k3s.go","lineNumber":165,"sourceCode":"\t// install k3s last to ensure it is the last step\n\tdownloadPath := \"/tmp/k3s-install.sh\"\n\turl := \"https://raw.githubusercontent.com/k3s-io/k3s/\" + k3sVersion + \"/install.sh\"\n\ta.Add(func() error {\n\t\tr := downloader.Request{URL: url}\n\t\treturn downloader.DownloadToGuest(host, guest, r, downloadPath)\n\t})\n\ta.Add(func() error {\n\t\treturn guest.Run(\"sudo\", \"install\", downloadPath, \"/usr/local/bin/k3s-install.sh\")\n\t})\n\n\targs := append([]string{\n\t\t\"--write-kubeconfig-mode\", \"644\",\n\t}, k3sArgs...)\n\n\ta.Retry(\"waiting for VM IP address\", time.Second*5, 4, func(retryCount int) error {\n\t\tipAddress := limautil.IPAddress(config.CurrentProfile().ID)\n\t\tif ipAddress == \"\" {\n\t\t\treturn fmt.Errorf(\"no IP address assigned to network interface\")\n\t\t}\n\n\t\tif ipAddress == \"127.0.0.1\" {\n\t\t\targs = append(args, \"--flannel-iface\", \"eth0\")\n\t\t} else {\n\t\t\tif !hasK3sArg(k3sArgs, \"--advertise-address\") {\n\t\t\t\targs = append(args, \"--advertise-address\", ipAddress)\n\t\t\t}\n\t\t\tif !hasK3sArg(k3sArgs, \"--flannel-iface\") {\n\t\t\t\targs = append(args, \"--flannel-iface\", limautil.NetInterface)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\tswitch containerRuntime {\n\tcase docker.Name:\n\t\targs = append(args, \"--docker\")","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/container/kubernetes/k3s.go#L147-L183","documentation":"Thrown inside an a.Rtry('waiting for VM IP address', 5s, 4 attempts) loop while installing the k3s cluster: limautil.IPAddress(profile) returned an empty string, meaning the Lima VM's network interface had not yet acquired (or failed to acquire) an IP address. The IP is needed to seed k3s args (--advertise-address / --flannel-iface), so the retry aborts and k3s installation fails.","triggerScenarios":"Running k3s provisioning immediately after 'colima start' while the guest's DHCP/interface bring-up is still in flight (all 4×5s retries exhausted); the VM booted but eth0/lima0 has no lease because vmnet/networks are broken; a custom Lima network config (e.g. --network-address with a failed vmnet daemon) leaving the interface unconfigured; or the Lima instance state file not yet exposing the IP via limautil.IPAddress.","commonSituations":"Slow or overloaded macOS machine where the VM takes >20s to get a lease; Hyper-V/QEMU backend hangs; vmnet network misconfiguration (networks: in lima yaml) preventing DHCP; vpn or firewall (Little Snitch, corporate VPN) blocking the guest DHCP; colima resume/start races where limactl has not finished writing instance metadata.","solutions":["Just retry 'colima start --kubernetes' — a transient DHCP race usually resolves on the second run.","Check that the VM actually has an IP: 'limactl list', 'colima ssh -- ip addr', and look at eth0/lima0; if no lease, inspect the lima instance logs ('limactl list --format json', ~/.lima/<profile>/log*) for slirp/vmnet errors.","Disable or fix custom networks: start with plain defaults (no --network-address, no custom 'networks:' entries) to confirm vmnet is the culprit.","If a VPN/firewall is active, disconnect it or allow the vmnet/gvisor-slirp helper processes, then retry.","Recreate the VM if the state is wedged: 'colima delete -f && colima start --kubernetes'."],"exampleFix":"// before\nipAddress := limautil.IPAddress(config.CurrentProfile().ID)\nif ipAddress == \"\" {\n    return fmt.Errorf(\"no IP address assigned to network interface\")\n}\n// after (extend patience before failing)\nif ipAddress == \"\" {\n    return fmt.Errorf(\"no IP address assigned to network interface: %w\", errRetry)\n}\n// i.e. rely on the enclosing a.Retry(\"waiting for VM IP address\", 5*time.Second, 12, ...) with more attempts","handlingStrategy":"retry","validationCode":"// probe the VM IP before invoking k3s provisioning\nip := limautil.IPAddress(config.CurrentProfile().ID)\nif ip == \"\" {\n    return fmt.Errorf(\"vm has no IP yet; wait for boot before provisioning kubernetes\")\n}","typeGuard":null,"tryCatchPattern":"// wrap the install call in a retry with backoff, the code already retries 4x5s\nerr := retry(12, 5*time.Second, func() error {\n    if ip := limautil.IPAddress(profile); ip == \"\" {\n        return fmt.Errorf(\"no IP address assigned to network interface\")\n    }\n    return nil\n})","preventionTips":["Avoid custom vmnet networks unless needed; default slirp always yields an IP quickly.","Give the VM a few seconds after 'colima start' before scripting kubernetes provisioning steps.","Disable/allow-list VPN and firewall software for the lima/gvproxy processes."],"tags":["kubernetes","k3s","network","lima","dhcp","vm"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}