{"record":{"id":"5cf04329e2e2964c","repo":"hashicorp/nomad","slug":"s-s-5cf043","errorCode":null,"errorMessage":"%s: %s","messagePattern":"%s: %s","errorType":"exception","errorClass":"ErrUnknownAllocationPrefix","httpStatus":null,"severity":"error","filePath":"nomad/csi_endpoint.go","lineNumber":488,"sourceCode":"\n\tif args.VolumeID == \"\" {\n\t\treturn fmt.Errorf(\"missing volume ID\")\n\t}\n\n\tisNewClaim := args.Claim != structs.CSIVolumeClaimGC &&\n\t\targs.State == structs.CSIVolumeClaimStateTaken\n\t// COMPAT(1.0): the NodeID field was added after 0.11.0 and so we\n\t// need to ensure it's been populated during upgrades from 0.11.0\n\t// to later patch versions. Remove this block in 1.0\n\tif isNewClaim && args.NodeID == \"\" {\n\t\tstate := v.srv.fsm.State()\n\t\tws := memdb.NewWatchSet()\n\t\talloc, err := state.AllocByID(ws, args.AllocationID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif alloc == nil {\n\t\t\treturn fmt.Errorf(\"%s: %s\",\n\t\t\t\tstructs.ErrUnknownAllocationPrefix, args.AllocationID)\n\t\t}\n\t\targs.NodeID = alloc.NodeID\n\t}\n\n\t_, index, err := v.srv.raftApply(structs.CSIVolumeClaimRequestType, args)\n\tif err != nil {\n\t\tv.logger.Error(\"csi raft apply failed\", \"error\", err, \"method\", \"claim\")\n\t\treturn err\n\t}\n\n\tif isNewClaim {\n\t\t// if this is a new claim, add a Volume and PublishContext from the\n\t\t// controller (if any) to the reply\n\t\terr = v.controllerPublishVolume(args, reply)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"controller publish: %v\", err)\n\t\t}","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/csi_endpoint.go#L470-L506","documentation":"For claim requests where NodeID is not already set, Claim looks up the allocation by AllocationID to derive the node. If the allocation does not exist, it fails with ErrUnknownAllocationPrefix plus the allocation ID.","triggerScenarios":"Claiming a CSI volume with an AllocationID that is absent from state store (alloc GCed, wrong ID, or alloc never created), while args.NodeID is empty.","commonSituations":"Referencing an allocation from a completed/GCed job; typo'd alloc ID in manual API calls; race where alloc is purged before volume claim; cluster restore losing allocs.","solutions":["Verify the allocation ID with nomad alloc status <id> and use a live alloc","Ensure NodeID is set in the claim request so lookup can be skipped","Re-run the job to create a fresh allocation before claiming the volume"],"exampleFix":"// before\nreq := structs.CSIVolumeClaimRequest{AllocationID: \"bad-id\", VolumeID: volID}\n// after\nreq := structs.CSIVolumeClaimRequest{AllocationID: liveAllocID, VolumeID: volID, NodeID: nodeID}","handlingStrategy":"validation","validationCode":"alloc, _, err := client.Allocations().Info(allocID, nil)\nif err != nil || alloc == nil {\n    return fmt.Errorf(\"allocation %s not found\", allocID)\n}","typeGuard":"func allocExists(a *api.Allocation) bool { return a != nil && a.ID != \"\" }","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), structs.ErrUnknownAllocationPrefix) { fetch a live alloc and retry }","preventionTips":["Use allocations from a live job, not GCed history","Set NodeID explicitly to skip alloc lookup","Check nomad alloc status before volume claims"],"tags":["csi","allocation","lookup"],"backgroundTag":"unknown-allocation","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"}