{"record":{"id":"e3b2d5471132ec23","repo":"cilium/cilium","slug":"failed-to-get-link-after-rename-w","errorCode":null,"errorMessage":"failed to get link after rename: %w","messagePattern":"failed to get link after rename: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/networkdriver/nri.go","lineNumber":379,"sourceCode":"\treturn \"\"\n}\n\n// configureIfName renames an interface to newIfName if the current link name differs from the\n// newIfName and newIfName is not empty.\nfunc configureIfName(l netlink.Link, newIfName string) (netlink.Link, error) {\n\tif newIfName == \"\" || l.Attrs().Name == newIfName {\n\t\t// no changes needed\n\t\treturn l, nil\n\t}\n\n\tif err := netlink.LinkSetName(l, newIfName); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to rename interface from %s to %s: %w\", l.Attrs().Name, newIfName, err)\n\t}\n\n\t// Refresh link reference after rename\n\tl, err := safenetlink.LinkByName(newIfName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get link after rename: %w\", err)\n\t}\n\n\treturn l, nil\n}\n\n// validateInterfaceNames checks if a pod's set of allocated devices\n// contain valid interface names, that dont collide with interfaces in the pod namespace.\nfunc validateInterfaceNames(alloc []allocation) error {\n\texistingLinks, err := safenetlink.LinkList()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to list existing interfaces in pod netns: %w\", err)\n\t}\n\n\texistingNames := make(map[string]bool)\n\tfor _, link := range existingLinks {\n\t\texistingNames[link.Attrs().Name] = true\n\t}\n","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/networkdriver/nri.go#L361-L397","documentation":"After a successful LinkSetName rename, configureIfName re-fetches the link under its new name to return a fresh reference. This error means the rename appeared to succeed but the link could not be found afterwards — an unexpected state indicating the link disappeared or a netlink cache/lookup issue.","triggerScenarios":"netlink.LinkSetName succeeded but the subsequent safenetlink.LinkByName(newIfName) fails — the interface was removed concurrently (e.g. link monitor/other actor deleted it), or the rename raced with netns movement so the handle is in another namespace.","commonSituations":"Racing device teardown while the sandbox is stopping; SR-IOV VF unplugged by the PF driver during rename; netlink socket errors under memory pressure.","solutions":["Retry the sandbox operation: the error is rare and usually transient; restart the pod.","Check node logs/dmesg for link removal events at the same timestamp (VF removed, link down).","Verify no other component (CNI, device plugin) deletes or renames interfaces concurrently in the pod netns.","If persistent, restart the agent and re-create the pod to get a fresh device."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := driver.RunPodSandbox(ctx, sandbox)\nif err != nil && strings.Contains(err.Error(), \"failed to get link after rename\") {\n    // transient race: backoff and retry sandbox start once\n}","preventionTips":["Avoid other components deleting/renaming pod interfaces concurrently","Monitor dmesg for VF/link removal events that race with sandbox setup","Retry sandbox start with backoff on this rare transient error"],"tags":["network","netlink","nri","race-condition"],"backgroundTag":"interface-rename-failed","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}