cilium/cilium · error

name is unset

Error message

name is unset

What it means

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.

Source

Thrown at pkg/node/types/node.go:514

	return nil
}

// LogRepr returns a representation of the node to be used for logging
func (n *Node) LogRepr() string {
	b, err := n.Marshal()
	if err != nil {
		return fmt.Sprintf("%#v", n)
	}
	return string(b)
}

func (n *Node) validate() error {
	switch {
	case n.Cluster == "":
		return errors.New("cluster is unset")
	case n.Name == "":
		return errors.New("name is unset")
	}

	return nil
}

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Set the `name` field on the Node/CiliumNode before unmarshalling.
  2. If generating nodes programmatically, fail fast when the node name is empty instead of passing an empty struct.
  3. Check templating (Helm/GitOps) so the node-name variable is actually rendered.

Example fix

// before
{n: &Node{Cluster: "c1"}}
// after
{n: &Node{Cluster: "c1", Name: "ip-10-0-0-1"}}
Defensive patterns

Strategy: validation

Validate before calling

if node.Name == "" {
    return fmt.Errorf("refusing to unmarshal node: name is unset")
}

Type guard

func hasName(n *types.Node) bool { return n != nil && n.Name != "" }

Try / catch

n, err := types.Unmarshal(buf)
if err != nil {
    if strings.Contains(err.Error(), "name is unset") {
        return fmt.Errorf("node object missing name field: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling Unmarshal on a Node whose `name` field is empty or omitted.

Common situations: Dynamically generated CiliumNode specs where the node name variable is empty; YAML manifests missing `metadata.name`/`name`; bulk-import tooling producing empty names.

Understand the failure class

Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.

Related errors


AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31). Data as JSON: /api/errors/43812e41d2e39b84. Report an issue: GitHub.