{"record":{"id":"43c491a6d101b626","repo":"hashicorp/nomad","slug":"missing-volume-definition","errorCode":null,"errorMessage":"missing volume definition","messagePattern":"missing volume definition","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/csi_endpoint.go","lineNumber":297,"sourceCode":"\tif authErr != nil {\n\t\treturn structs.ErrPermissionDenied\n\t}\n\n\tallowVolume := acl.NamespaceValidator(acl.NamespaceCapabilityCSIWriteVolume)\n\taclObj, err := v.srv.ResolveACL(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer metrics.MeasureSince([]string{\"nomad\", \"volume\", \"register\"}, time.Now())\n\n\t// permission for the volume namespaces will be checked below\n\tif !aclObj.AllowPluginRead() {\n\t\treturn structs.ErrPermissionDenied\n\t}\n\n\tif len(args.Volumes) == 0 {\n\t\treturn fmt.Errorf(\"missing volume definition\")\n\t}\n\n\tsnap, err := v.srv.State().Snapshot()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Validate ACLs, that the plugin exists for each volume, and validate the\n\t// capabilities when the plugin has a controller.\n\tfor _, vol := range args.Volumes {\n\t\tif vol.Namespace == \"\" {\n\t\t\tvol.Namespace = args.RequestNamespace()\n\t\t}\n\t\tif !allowVolume(aclObj, vol.Namespace) {\n\t\t\treturn structs.ErrPermissionDenied\n\t\t}\n\t\t// Check if override is set and we do not have permissions\n\t\tif args.PolicyOverride {","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/csi_endpoint.go#L279-L315","documentation":"Guard in the CSIVolume.Register RPC: the request contains no volume specifications (args.Volumes empty); registering volumes requires at least one volume definition.","triggerScenarios":"Calling the CSIVolumeRegister RPC / volume register API with args.Volumes empty, e.g. an HCL/JSON spec that parsed to zero volumes.","commonSituations":"Passing an empty or mis-parsed volume spec file to nomad volume register; scripting the API with an empty list; wrong filename or file containing no volume stanza.","solutions":["Provide a valid volume definition in the request body (args.Volumes)","Check the spec file path and content passed to nomad volume register","Validate the spec parses to at least one volume before calling the API"],"exampleFix":"// before\nnomad volume register empty.hcl\n// after\nnomad volume register volume.hcl  // file contains a 'volume' stanza","handlingStrategy":"validation","validationCode":"if len(args.Volumes) == 0 {\n    return errors.New(\"at least one volume definition required\")\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"missing volume definition\") { check spec file }","preventionTips":["Verify spec file path and content before nomad volume register","Ensure HCL parses to at least one volume stanza","Add CI validation of volume specs"],"tags":["validation","csi","api"],"backgroundTag":"missing-required-argument","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"}