{"record":{"id":"6fb71be0be29fc91","repo":"hashicorp/nomad","slug":"volume-not-found-s","errorCode":null,"errorMessage":"volume not found: %s","messagePattern":"volume not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/csi_endpoint.go","lineNumber":608,"sourceCode":"\t})\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"FailedPrecondition\") {\n\t\t\treturn fmt.Errorf(\"%v: %v\", structs.ErrCSIClientRPCRetryable, err)\n\t\t}\n\t\treturn err\n\t}\n\tresp.PublishContext = cResp.PublishContext\n\treturn nil\n}\n\nfunc (v *CSIVolume) volAndPluginLookup(namespace, volID string) (*structs.CSIPlugin, *structs.CSIVolume, error) {\n\tstate := v.srv.fsm.State()\n\tvol, err := state.CSIVolumeByID(nil, namespace, volID)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif vol == nil {\n\t\treturn nil, nil, fmt.Errorf(\"volume not found: %s\", volID)\n\t}\n\tif !vol.ControllerRequired {\n\t\treturn nil, vol, nil\n\t}\n\n\t// note: we do this same lookup in CSIVolumeByID but then throw\n\t// away the pointer to the plugin rather than attaching it to\n\t// the volume so we have to do it again here.\n\tplug, err := state.CSIPluginByID(nil, vol.PluginID)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif plug == nil {\n\t\treturn nil, nil, fmt.Errorf(\"plugin not found: %s\", vol.PluginID)\n\t}\n\treturn plug, vol, nil\n}\n","sourceCodeStart":590,"sourceCodeEnd":626,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/csi_endpoint.go#L590-L626","documentation":"volAndPluginLookup cannot find the requested CSI volume in Nomad's state store and returns \"volume not found: <id>\". This helper backs controllerPublishVolume and CSIVolume.Delete, so any claim or delete against a volume ID that is not registered under the given namespace produces this error. The volume ID and namespace must both match a registered volume.","triggerScenarios":"Raised when state.CSIVolumeByID(nil, namespace, volID) returns nil for the (namespace, volID) pair — the volume was deregistered (`nomad volume deregister`/`volume delete`), never registered, registered in a different namespace, or the ID was mistyped.","commonSituations":"Jobs reference volumes in host/CSI `volume` blocks whose registered ID doesn't match the `volume.source`; volumes deregistered while allocations still request them; ACL/namespace confusion where the caller's namespace differs from where the volume lives (e.g. `default` vs a team namespace).","solutions":["List volumes to confirm the ID and namespace: `nomad volume status -namespace <ns>` or GET /v1/csi/volumes.","Re-register the volume: `nomad volume register <volume-file>` if it was deregistered.","Fix the job's volume source / claim request to use the exact registered volume ID and correct namespace.","Check ACL policies — a policy scoped to the wrong namespace will hide the volume from the caller."],"exampleFix":"# before (job file)\nvolume \"db\" { type = \"csi\" source = \"db-vol\" }  # no volume named db-vol\n# after\nvolume \"db\" { type = \"csi\" source = \"ebs-db-vol\" }  # matches `nomad volume status ebs-db-vol`","handlingStrategy":"validation","validationCode":"vols, _, err := client.CSIVolumes().List(&capi.VolumeListOptions{Namespace: ns})\nif err != nil { return err }\nfound := false\nfor _, v := range vols { if v.ID == volID { found = true } }\nif !found { return fmt.Errorf(\"volume %s not registered in namespace %s\", volID, ns) }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"volume not found\") {\n    // register the volume or fix the job's volume.source before retrying\n}","preventionTips":["Keep job `volume.source` values identical to registered CSI volume IDs.","Don't deregister volumes while allocations still claim them.","Verify namespace in ACL tokens/requests matches the volume's namespace."],"tags":["nomad","csi","volume","not-found","namespace"],"backgroundTag":"volume-not-found","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"}