{"record":{"id":"13acd7fda2fa5c1e","repo":"derailed/k9s","slug":"unable-to-locate-node-s","errorCode":null,"errorMessage":"unable to locate node %s","messagePattern":"unable to locate node (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/dao/node.go","lineNumber":147,"sourceCode":"\n\treturn nil\n}\n\n// Get returns a node resource.\nfunc (n *Node) Get(ctx context.Context, path string) (runtime.Object, error) {\n\too, err := n.Resource.List(ctx, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar raw *unstructured.Unstructured\n\tfor _, o := range oo {\n\t\tif u, ok := o.(*unstructured.Unstructured); ok && u.GetName() == path {\n\t\t\traw = u\n\t\t}\n\t}\n\tif raw == nil {\n\t\treturn nil, fmt.Errorf(\"unable to locate node %s\", path)\n\t}\n\n\tvar nmx *mv1beta1.NodeMetrics\n\tif withMx, ok := ctx.Value(internal.KeyWithMetrics).(bool); ok && withMx {\n\t\tnmx, _ = client.DialMetrics(n.Client()).FetchNodeMetrics(ctx, path)\n\t}\n\n\tpodCount := -1\n\tif shouldCountPods, _ := ctx.Value(internal.KeyPodCounting).(bool); shouldCountPods {\n\t\tif pp, err := n.GetPods(path); err == nil {\n\t\t\tpodCount = len(pp)\n\t\t}\n\t}\n\n\treturn &render.NodeWithMetrics{Raw: raw, MX: nmx, PodCount: podCount}, nil\n}\n\n// List returns a collection of node resources.","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/dao/node.go#L129-L165","documentation":"Node.Get lists all nodes and scans for one whose name matches path; when no entry matches it returns this error. The List call succeeded, so this is strictly a name-mismatch / not-found-after-list failure, not an RBAC or connectivity problem.","triggerScenarios":"Node deleted (or recreated under a new name) between the list and the lookup; stale or mistyped node name; the DAO cache not yet synced after cluster changes.","commonSituations":"Autocomplete or saved reference from a previous session/cluster; node removed while a k9s session stayed open; kubeconfig context pointing at a different cluster that does not have that node.","solutions":["Verify the node exists in the same context: kubectl get nodes | grep <name>","Refresh/relist (reopen the view or restart the session) and retry once","Check the kubeconfig context — the name may belong to another cluster"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"nodes, err := dao.FetchNodes(ctx, factory, \"\")\nif err != nil { return err }\nfound := false\nfor _, nn := range nodes.Items {\n    if nn.Name == name { found = true; break }\n}\nif !found { return fmt.Errorf(\"node %q not present in cluster\", name) }","typeGuard":null,"tryCatchPattern":"if _, err := nodeDAO.Get(ctx, path); err != nil {\n    if strings.Contains(err.Error(), \"unable to locate node\") {\n        // one refresh + retry; after that surface 'node not found' to the user\n    }\n}","preventionTips":["Validate node names against a fresh node list before acting on user input or saved picks","Re-check existence after long-lived sessions resume (sleep/VPN) — caches go stale","Confirm the kubeconfig context matches the cluster the name came from"],"tags":["kubernetes","node","not-found","cache"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}