{"record":{"id":"40786863d6966ff0","repo":"hashicorp/nomad","slug":"missing-volumecapabilities","errorCode":null,"errorMessage":"missing VolumeCapabilities","messagePattern":"missing VolumeCapabilities","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/csi/plugin.go","lineNumber":187,"sourceCode":"\t\tTargetPath:        r.TargetPath,\n\t\tVolumeCapability:  r.VolumeCapability.ToCSIRepresentation(),\n\t\tReadonly:          r.Readonly,\n\t\tSecrets:           r.Secrets,\n\t\tVolumeContext:     r.VolumeContext,\n\t}\n}\n\nfunc (r *NodePublishVolumeRequest) Validate() error {\n\tif r.ExternalID == \"\" {\n\t\treturn errors.New(\"missing volume ID\")\n\t}\n\n\tif r.TargetPath == \"\" {\n\t\treturn errors.New(\"missing TargetPath\")\n\t}\n\n\tif r.VolumeCapability == nil {\n\t\treturn errors.New(\"missing VolumeCapabilities\")\n\t}\n\n\treturn nil\n}\n\ntype NodeStageVolumeRequest struct {\n\t// The external ID of the volume to stage.\n\tExternalID string\n\n\t// If the volume was attached via a call to `ControllerPublishVolume` then\n\t// we need to provide the returned PublishContext here.\n\tPublishContext map[string]string\n\n\t// The path to which the volume MAY be staged. It MUST be an\n\t// absolute path in the root filesystem of the process serving this\n\t// request, and MUST be a directory. The CO SHALL ensure that there\n\t// is only one `staging_target_path` per volume. The CO SHALL ensure\n\t// that the path is directory and that the process serving the","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/plugins/csi/plugin.go#L169-L205","documentation":"NodePublishVolumeRequest.Validate requires at least one VolumeCapability describing how the volume will be used (mount vs block access, filesystem type, access mode). A nil VolumeCapability means the plugin cannot determine how to expose the volume, so the request is rejected before contacting the storage provider.","triggerScenarios":"A CSI NodePublishVolume call with r.VolumeCapability == nil — e.g. a volume registered without access_mode/capabilities, or a request constructed programmatically without a capability, or a controller failing to copy capabilities from the stage phase into the publish phase.","commonSituations":"Volume spec in `nomad volume register` missing `access_mode` or `attachment_mode`; provider capabilities (from ControllerGetCapabilities) not supported/propagated; hand-written Go requests omitting VolumeCapability; Nomad/plugin version skew losing capability metadata.","solutions":["Re-register the volume with explicit attachment_mode and access_mode, e.g. `nomad volume register` with attachment_mode = \"file-system\", access_mode = \"single-node-writer\"","Verify the storage provider actually supports the requested capability (`nomad plugin status <csi-plugin>`)","Upgrade Nomad client/plugin to a compatible version if capability metadata is being dropped","When building requests in Go, populate VolumeCapability (mount with fs type, access mode) before Validate"],"exampleFix":"// before (HCL volume spec)\ncapabilities {\n  # attachment_mode / access_mode omitted\n}\n\n// after (HCL volume spec)\ncapabilities {\n  attachment_mode = \"file-system\"\n  access_mode     = \"single-node-writer\"\n}","handlingStrategy":"validation","validationCode":"if req.VolumeCapability == nil {\n    return fmt.Errorf(\"VolumeCapability is required\")\n}","typeGuard":null,"tryCatchPattern":"if err := req.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"missing VolumeCapabilities\") {\n        return fmt.Errorf(\"volume lacks attachment_mode/access_mode: %w\", err)\n    }\n    return err\n}","preventionTips":["Always specify attachment_mode and access_mode in volume specs","Check provider-supported capabilities via `nomad plugin status` first","Confirm volume capabilities exist via `nomad volume status` before mounting","Align Nomad and CSI plugin versions to avoid metadata loss"],"tags":["csi","storage","volume-capability","validation"],"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"}