{"record":{"id":"b60e804e14c4550b","repo":"hashicorp/nomad","slug":"claim-is-required","errorCode":null,"errorMessage":"Claim is required","messagePattern":"Claim is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/structs/csi.go","lineNumber":490,"sourceCode":"\t// used to determine capabilities and the mount point on the client\n\tClaim *structs.CSIVolumeClaim\n}\n\nfunc (req *ClientCSINodeExpandVolumeRequest) Validate() error {\n\tvar err error\n\t// These should not occur during normal operations; they're here\n\t// mainly to catch potential programmer error.\n\tif req.PluginID == \"\" {\n\t\terr = errors.Join(err, errors.New(\"PluginID is required\"))\n\t}\n\tif req.VolumeID == \"\" {\n\t\terr = errors.Join(err, errors.New(\"VolumeID is required\"))\n\t}\n\tif req.ExternalID == \"\" {\n\t\terr = errors.Join(err, errors.New(\"ExternalID is required\"))\n\t}\n\tif req.Claim == nil {\n\t\terr = errors.Join(err, errors.New(\"Claim is required\"))\n\t} else if req.Claim.AllocationID == \"\" {\n\t\terr = errors.Join(err, errors.New(\"Claim.AllocationID is required\"))\n\t}\n\treturn err\n}\n\ntype ClientCSINodeExpandVolumeResponse struct {\n\tCapacityBytes int64\n}\n","sourceCodeStart":472,"sourceCodeEnd":500,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/structs/csi.go#L472-L500","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Populate req.Claim with a *structs.CSIVolumeClaim that includes the allocation","Set Claim.AllocationID to the alloc ID of the allocation requesting the expansion","Check that the code path building the request derives the claim from the volume's claim state rather than passing nil","If seen in normal operation, file a Nomad bug — this indicates programmer error upstream"],"exampleFix":"// before\nreq := &cstructs.ClientCSINodeExpandVolumeRequest{PluginID: \"aws.efs\", VolumeID: volID, ExternalID: extID}\nerr := req.Validate() // \"Claim is required\"\n// after\nreq := &cstructs.ClientCSINodeExpandVolumeRequest{PluginID: \"aws.efs\", VolumeID: volID, ExternalID: extID,\n\tClaim: &cstructs.CSIVolumeClaim{AllocationID: alloc.ID, NodeID: node.ID, Mode: structs.CSIVolumeClaimMode}}\nerr := req.Validate()","handlingStrategy":"validation","validationCode":"func validNodeExpand(req *cstructs.ClientCSINodeExpandVolumeRequest) error {\n\tif req.Claim == nil {\n\t\treturn fmt.Errorf(\"Claim is required\")\n\t}\n\tif req.Claim.AllocationID == \"\" {\n\t\treturn fmt.Errorf(\"Claim.AllocationID is required\")\n\t}\n\treturn nil\n}","typeGuard":"func hasClaim(req *cstructs.ClientCSINodeExpandVolumeRequest) bool {\n\treturn req != nil && req.Claim != nil && req.Claim.AllocationID != \"\"\n}","tryCatchPattern":"if err := req.Validate(); err != nil {\n\tif strings.Contains(err.Error(), \"Claim is required\") {\n\t\t// rebuild request with hydrated claim\n\t}\n\treturn err\n}","preventionTips":["Always hydrate Claim from the volume's claim state before issuing node expand RPCs","Call req.Validate() in unit tests for any hand-built CSI requests","Never pass a zero-value ClientCSINodeExpandVolumeRequest to the client"],"tags":["csi","validation","nomad","storage"],"backgroundTag":"csi-request-validation-failed","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}