{"record":{"id":"00082ad96bfd2ef0","repo":"hashicorp/nomad","slug":"missing-name-00082a","errorCode":null,"errorMessage":"missing Name","messagePattern":"missing Name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/csi/plugin.go","lineNumber":494,"sourceCode":"\tfor _, cap := range r.VolumeCapabilities {\n\t\tcaps = append(caps, cap.ToCSIRepresentation())\n\t}\n\treq := &csipbv1.CreateVolumeRequest{\n\t\tName:                      r.Name,\n\t\tCapacityRange:             r.CapacityRange.ToCSIRepresentation(),\n\t\tVolumeCapabilities:        caps,\n\t\tParameters:                r.Parameters,\n\t\tSecrets:                   r.Secrets,\n\t\tVolumeContentSource:       r.ContentSource.ToCSIRepresentation(),\n\t\tAccessibilityRequirements: r.AccessibilityRequirements.ToCSIRepresentation(),\n\t}\n\n\treturn req\n}\n\nfunc (r *ControllerCreateVolumeRequest) Validate() error {\n\tif r.Name == \"\" {\n\t\treturn errors.New(\"missing Name\")\n\t}\n\tif r.VolumeCapabilities == nil {\n\t\treturn errors.New(\"missing VolumeCapabilities\")\n\t}\n\tif r.CapacityRange != nil {\n\t\tif r.CapacityRange.LimitBytes == 0 && r.CapacityRange.RequiredBytes == 0 {\n\t\t\treturn errors.New(\n\t\t\t\t\"one of LimitBytes or RequiredBytes must be set if CapacityRange is set\")\n\t\t}\n\t\tif r.CapacityRange.LimitBytes > 0 &&\n\t\t\tr.CapacityRange.LimitBytes < r.CapacityRange.RequiredBytes {\n\t\t\treturn errors.New(\"LimitBytes cannot be less than RequiredBytes\")\n\t\t}\n\t}\n\tif r.ContentSource != nil {\n\t\tif r.ContentSource.CloneID != \"\" && r.ContentSource.SnapshotID != \"\" {\n\t\t\treturn errors.New(\n\t\t\t\t\"one of SnapshotID or CloneID must be set if ContentSource is set\")","sourceCodeStart":476,"sourceCodeEnd":512,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/plugins/csi/plugin.go#L476-L512","documentation":"ControllerCreateVolumeRequest.Validate() rejects requests with an empty Name. Name identifies the volume being created and is used for idempotency and provider-side labeling. An empty name means the caller never labeled the volume request, so creation is refused.","triggerScenarios":"Calling ControllerCreateVolume (via NodePublishVolume-driven creation flows) with Name empty, e.g. a zero-value request or a volume spec whose name field was never filled.","commonSituations":"Orchestrator code generating volumes without assigning a unique name; config/job templates missing the volume name; programmatic volume provisioning in tests using zero-value structs.","solutions":["Set Name to a unique, stable identifier for the volume (e.g. the claim/volume ID) before calling","Ensure the volume spec/claim object carries a non-empty name through to the request builder","Check template rendering or ID generation that may produce an empty string"],"exampleFix":"// before\nreq := &csi.ControllerCreateVolumeRequest{\n    VolumeCapabilities: caps,\n}\n// after\nreq := &csi.ControllerCreateVolumeRequest{\n    Name:               \"vol-\" + claim.ID,\n    VolumeCapabilities: caps,\n}","handlingStrategy":"validation","validationCode":"func validateCreateVolume(req *csi.ControllerCreateVolumeRequest) error {\n    if req.Name == \"\" {\n        return errors.New(\"Name must be a unique, stable volume identifier\")\n    }\n    return nil\n}","typeGuard":"func hasName(req *csi.ControllerCreateVolumeRequest) bool {\n    return req != nil && req.Name != \"\"\n}","tryCatchPattern":"if err := req.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"missing Name\") {\n        return fmt.Errorf(\"create refused: assign a unique name (e.g. claim ID) to the volume request: %w\", err)\n    }\n    return err\n}","preventionTips":["Derive Name from the claim/claimant ID in one builder function","Validate volume specs (including name) before submitting them to the orchestrator","Add a smoke test creating a volume through the full request path"],"tags":["csi","validation","go","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"}