{"record":{"id":"43812e41d2e39b84","repo":"cilium/cilium","slug":"name-is-unset-43812e","errorCode":null,"errorMessage":"name is unset","messagePattern":"name is unset","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/node/types/node.go","lineNumber":514,"sourceCode":"\n\treturn nil\n}\n\n// LogRepr returns a representation of the node to be used for logging\nfunc (n *Node) LogRepr() string {\n\tb, err := n.Marshal()\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"%#v\", n)\n\t}\n\treturn string(b)\n}\n\nfunc (n *Node) validate() error {\n\tswitch {\n\tcase n.Cluster == \"\":\n\t\treturn errors.New(\"cluster is unset\")\n\tcase n.Name == \"\":\n\t\treturn errors.New(\"name is unset\")\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":496,"sourceCodeEnd":519,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/node/types/node.go#L496-L519","documentation":"Node.validate() requires every CiliumNode to have a node name. Unmarshal calls validate, so a Node whose `name` field is empty is rejected. The name, together with the cluster, forms the node identity used by Cilium's allocation and discovery logic.","triggerScenarios":"Calling Unmarshal on a Node whose `name` field is empty or omitted.","commonSituations":"Dynamically generated CiliumNode specs where the node name variable is empty; YAML manifests missing `metadata.name`/`name`; bulk-import tooling producing empty names.","solutions":["Set the `name` field on the Node/CiliumNode before unmarshalling.","If generating nodes programmatically, fail fast when the node name is empty instead of passing an empty struct.","Check templating (Helm/GitOps) so the node-name variable is actually rendered."],"exampleFix":"// before\n{n: &Node{Cluster: \"c1\"}}\n// after\n{n: &Node{Cluster: \"c1\", Name: \"ip-10-0-0-1\"}}","handlingStrategy":"validation","validationCode":"if node.Name == \"\" {\n    return fmt.Errorf(\"refusing to unmarshal node: name is unset\")\n}","typeGuard":"func hasName(n *types.Node) bool { return n != nil && n.Name != \"\" }","tryCatchPattern":"n, err := types.Unmarshal(buf)\nif err != nil {\n    if strings.Contains(err.Error(), \"name is unset\") {\n        return fmt.Errorf(\"node object missing name field: %w\", err)\n    }\n    return err\n}","preventionTips":["Ensure metadata.name/name is set before unmarshalling","Fail fast in generators when node name variables are empty","Add CI checks that rendered templates contain non-empty names"],"tags":["cilium","node","validation","configuration"],"backgroundTag":"missing-required-field","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}