{"record":{"id":"b373d16d3a0515d1","repo":"hashicorp/nomad","slug":"unknown-volume-attachment-mode-s","errorCode":null,"errorMessage":"unknown volume attachment mode: %s","messagePattern":"unknown volume attachment mode: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/csi/plugin.go","lineNumber":963,"sourceCode":"\tAccessMode VolumeAccessMode\n\n\t// Indicate that the volume will be accessed via the filesystem API.\n\tMountVolume *structs.CSIMountOptions\n}\n\nfunc VolumeCapabilityFromStructs(sAccessType structs.VolumeAttachmentMode, sAccessMode structs.VolumeAccessMode, sMountOptions *structs.CSIMountOptions) (*VolumeCapability, error) {\n\tvar accessType VolumeAccessType\n\tswitch sAccessType {\n\tcase structs.CSIVolumeAttachmentModeBlockDevice:\n\t\taccessType = VolumeAccessTypeBlock\n\tcase structs.CSIVolumeAttachmentModeFilesystem:\n\t\taccessType = VolumeAccessTypeMount\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 attachment mode: %s\", sAccessType)\n\t}\n\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","sourceCodeStart":945,"sourceCodeEnd":981,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/plugins/csi/plugin.go#L945-L981","documentation":"When transforming a Nomad CSIVolume's requested capabilities into the CSI plugin's VolumeCapability, the attachment (access) type string was not 'mount' or 'block'. Nomad validates this at job submission, so hitting it here indicates corrupted state, a development bug, or a Nomad version mismatch writing incompatible data.","triggerScenarios":"CSIVolumeCapability.AccessType contains a value other than \"mount\" or \"block\" when the volume capability is converted for the plugin (volume publish/claim path).","commonSituations":"Hand-edited or corrupted volume state in the state store; an older/newer Nomad binary reading volumes written by an incompatible version; a bug in custom tooling writing volume specs directly.","solutions":["Correct the volume specification so attachment_mode is exactly \"mount\" or \"block\", then re-register: `nomad volume register <corrected.hcl>`","Validate the job/volume spec with `nomad job validate` / `nomad volume validate` before submission","If state corruption is suspected, check the Nomad server state store and Nomad version compatibility; upgrade Nomad and re-create the volume"],"exampleFix":"// before (volume hcl)\nattachment_mode = \" Mount\"\n// after\nattachment_mode = \"mount\"\n// or \"block\" for raw block volumes","handlingStrategy":"validation","validationCode":"// Go: assert attachment mode before building capabilities\nvalid := map[string]bool{\"mount\": true, \"block\": true}\nif !valid[sAccessType] {\n    return fmt.Errorf(\"attachment_mode must be 'mount' or 'block', got %q\", sAccessType)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `nomad volume validate` on HCL before registering volumes","Never hand-edit volume state in the server store","Keep Nomad client/server versions in sync to avoid capability transformation mismatches"],"tags":["csi","validation","volume","configuration"],"backgroundTag":"invalid-csi-volume-attachment-mode","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}