hashicorp/nomad · error

Claim is required

Error message

Claim is required

What it means

This error is produced by ClientCSINodeExpandVolumeRequest.Validate() in client/structs/csi.go when the volume-expansion request has a nil Claim. The comment in the code states these checks mainly catch programmer error, since a nil claim should never reach the client during normal Nomad operations. The error is joined with any other validation failures via errors.Join, so it can appear alongside PluginID/VolumeID/ExternalID errors.

Source

Thrown at client/structs/csi.go:490

	// used to determine capabilities and the mount point on the client
	Claim *structs.CSIVolumeClaim
}

func (req *ClientCSINodeExpandVolumeRequest) Validate() error {
	var err error
	// These should not occur during normal operations; they're here
	// mainly to catch potential programmer error.
	if req.PluginID == "" {
		err = errors.Join(err, errors.New("PluginID is required"))
	}
	if req.VolumeID == "" {
		err = errors.Join(err, errors.New("VolumeID is required"))
	}
	if req.ExternalID == "" {
		err = errors.Join(err, errors.New("ExternalID is required"))
	}
	if req.Claim == nil {
		err = errors.Join(err, errors.New("Claim is required"))
	} else if req.Claim.AllocationID == "" {
		err = errors.Join(err, errors.New("Claim.AllocationID is required"))
	}
	return err
}

type ClientCSINodeExpandVolumeResponse struct {
	CapacityBytes int64
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Populate req.Claim with a *structs.CSIVolumeClaim that includes the allocation
  2. Set Claim.AllocationID to the alloc ID of the allocation requesting the expansion
  3. Check that the code path building the request derives the claim from the volume's claim state rather than passing nil
  4. If seen in normal operation, file a Nomad bug — this indicates programmer error upstream

Example fix

// before
req := &cstructs.ClientCSINodeExpandVolumeRequest{PluginID: "aws.efs", VolumeID: volID, ExternalID: extID}
err := req.Validate() // "Claim is required"
// after
req := &cstructs.ClientCSINodeExpandVolumeRequest{PluginID: "aws.efs", VolumeID: volID, ExternalID: extID,
	Claim: &cstructs.CSIVolumeClaim{AllocationID: alloc.ID, NodeID: node.ID, Mode: structs.CSIVolumeClaimMode}}
err := req.Validate()
Defensive patterns

Strategy: validation

Validate before calling

func validNodeExpand(req *cstructs.ClientCSINodeExpandVolumeRequest) error {
	if req.Claim == nil {
		return fmt.Errorf("Claim is required")
	}
	if req.Claim.AllocationID == "" {
		return fmt.Errorf("Claim.AllocationID is required")
	}
	return nil
}

Type guard

func hasClaim(req *cstructs.ClientCSINodeExpandVolumeRequest) bool {
	return req != nil && req.Claim != nil && req.Claim.AllocationID != ""
}

Try / catch

if err := req.Validate(); err != nil {
	if strings.Contains(err.Error(), "Claim is required") {
		// rebuild request with hydrated claim
	}
	return err
}

Prevention

When it happens

Trigger: Calling the CSI NodeExpandVolume client RPC with a ClientCSINodeExpandVolumeRequest whose Claim field is nil — i.e. building the request manually without populating the CSIVolumeClaim, or a server-side code path that drops the claim before forwarding.

Common situations: Custom Nomad forks or plugins constructing node expand requests by hand; internal Nomad bugs where a CSI claim is not attached before the client RPC; tests exercising the ACL/validation paths (init, NewACL, TestACLManagement) that build empty requests.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/b60e804e14c4550b. Report an issue: GitHub.