{"record":{"id":"d1fcc08509f3c50b","repo":"hashicorp/nomad","slug":"unknown-volume-access-mode-v","errorCode":null,"errorMessage":"unknown volume access mode: %v","messagePattern":"unknown volume access mode: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/csi/plugin.go","lineNumber":983,"sourceCode":"\n\tvar accessMode VolumeAccessMode\n\tswitch sAccessMode {\n\tcase structs.CSIVolumeAccessModeSingleNodeReader:\n\t\taccessMode = VolumeAccessModeSingleNodeReaderOnly\n\tcase structs.CSIVolumeAccessModeSingleNodeWriter:\n\t\taccessMode = VolumeAccessModeSingleNodeWriter\n\tcase structs.CSIVolumeAccessModeMultiNodeMultiWriter:\n\t\taccessMode = VolumeAccessModeMultiNodeMultiWriter\n\tcase structs.CSIVolumeAccessModeMultiNodeSingleWriter:\n\t\taccessMode = VolumeAccessModeMultiNodeSingleWriter\n\tcase structs.CSIVolumeAccessModeMultiNodeReader:\n\t\taccessMode = VolumeAccessModeMultiNodeReaderOnly\n\tdefault:\n\t\t// These fields are validated during job submission, but here we perform a\n\t\t// final check during transformation into the requisite CSI Data type to\n\t\t// defend against development bugs and corrupted state - and incompatible\n\t\t// nomad versions in the future.\n\t\treturn nil, fmt.Errorf(\"unknown volume access mode: %v\", sAccessMode)\n\t}\n\n\treturn &VolumeCapability{\n\t\tAccessType:  accessType,\n\t\tAccessMode:  accessMode,\n\t\tMountVolume: sMountOptions,\n\t}, nil\n}\n\nfunc (c *VolumeCapability) ToCSIRepresentation() *csipbv1.VolumeCapability {\n\tif c == nil {\n\t\treturn nil\n\t}\n\n\tvc := &csipbv1.VolumeCapability{\n\t\tAccessMode: &csipbv1.VolumeCapability_AccessMode{\n\t\t\tMode: c.AccessMode.ToCSIRepresentation(),\n\t\t},","sourceCodeStart":965,"sourceCodeEnd":1001,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/plugins/csi/plugin.go#L965-L1001","documentation":"Same transformation path as the attachment-mode check: the volume's access_mode string did not match any known CSIXVolumeAccessMode constant (e.g. single-node-writer, multi-node-reader). Nomad re-validates during conversion to the plugin's VolumeCapability to defend against dev bugs, corrupted state, or incompatible Nomad versions.","triggerScenarios":"CSIVolumeCapability.AccessMode holds an unrecognized string when converting capabilities for the CSI plugin — anything not in the supported single-node-* / multi-node-* set.","commonSituations":"Typo'd access_mode in a hand-written volume HCL that bypassed validation; state written by a different Nomad version; corrupted server state.","solutions":["Fix access_mode in the volume spec to a supported value (e.g. single-node-writer, single-node-reader-only, multi-node-single-writer, multi-node-multi-writer, multi-node-reader-only) and re-register","Run `nomad volume validate` on the HCL before registering to catch the bad value early","Check Nomad version compatibility if the volume was created by another binary/version and recreate the volume from a clean spec"],"exampleFix":"// before\naccess_mode = \"multi-node-reader\"\n// after\naccess_mode = \"multi-node-reader-only\"","handlingStrategy":"validation","validationCode":"// Go: whitelist known access modes before conversion\nallowed := map[string]bool{\n    \"single-node-reader-only\": true,\n    \"single-node-writer\": true,\n    \"multi-node-reader-only\": true,\n    \"multi-node-single-writer\": true,\n    \"multi-node-multi-writer\": true,\n}\nif !allowed[sAccessMode] {\n    return fmt.Errorf(\"unsupported access_mode %q\", sAccessMode)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use exact constant strings from Nomad docs for access_mode in volume specs","Validate volume HCL with `nomad volume validate` prior to registration","Recreate volumes from clean specs after Nomad version upgrades"],"tags":["csi","validation","volume","configuration"],"backgroundTag":"invalid-csi-volume-access-mode","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"}