{"record":{"id":"8f59aad9ebfa2871","repo":"hashicorp/nomad","slug":"csi-plugin-lookup-failed-s-v","errorCode":null,"errorMessage":"csi_plugin lookup failed: %s %v","messagePattern":"csi_plugin lookup failed: (.+?) (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/state/state_store.go","lineNumber":3202,"sourceCode":"}\n\n// CSIPluginByID returns a named CSIPlugin. This method creates a new\n// transaction so you should not call it from within another transaction.\nfunc (s *StateStore) CSIPluginByID(ws memdb.WatchSet, id string) (*structs.CSIPlugin, error) {\n\ttxn := s.db.ReadTxn()\n\tplugin, err := s.CSIPluginByIDTxn(txn, ws, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn plugin, nil\n}\n\n// CSIPluginByIDTxn returns a named CSIPlugin\nfunc (s *StateStore) CSIPluginByIDTxn(txn Txn, ws memdb.WatchSet, id string) (*structs.CSIPlugin, error) {\n\n\twatchCh, obj, err := txn.FirstWatch(TableCSIPlugins, \"id\", id)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"csi_plugin lookup failed: %s %v\", id, err)\n\t}\n\n\tws.Add(watchCh)\n\n\tif obj != nil {\n\t\treturn obj.(*structs.CSIPlugin), nil\n\t}\n\treturn nil, nil\n}\n\n// CSIPluginDenormalize returns a CSIPlugin with allocation details. Always called on a copy of the plugin.\nfunc (s *StateStore) CSIPluginDenormalize(ws memdb.WatchSet, plug *structs.CSIPlugin) (*structs.CSIPlugin, error) {\n\ttxn := s.db.ReadTxn()\n\treturn s.CSIPluginDenormalizeTxn(txn, ws, plug)\n}\n\nfunc (s *StateStore) CSIPluginDenormalizeTxn(txn Txn, ws memdb.WatchSet, plug *structs.CSIPlugin) (*structs.CSIPlugin, error) {\n\tif plug == nil {","sourceCodeStart":3184,"sourceCodeEnd":3220,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/state/state_store.go#L3184-L3220","documentation":"CSIPluginByIDTxn fetches a single CSIPlugin by ID using txn.FirstWatch on the csi_plugins table's \"id\" index. This error wraps a FirstWatch failure — a memdb-level error (invalid index/table), NOT a missing plugin (that returns nil obj, nil err). Callers like csiVolumeDenormalizePluginsTxn and CSIPluginByID re-wrap it.","triggerScenarios":"Any CSIPluginByID/CSIPluginByIDTxn call where txn.FirstWatch(TableCSIPlugins, \"id\", id) returns an error — internal memdb failure rather than absent data.","commonSituations":"Corrupt state store, incompatible state DB from a different Nomad version, or memory pressure damaging the memdb table.","solutions":["Read the wrapped %v error for the underlying memdb cause.","Restart the server agent to rebuild state from Raft snapshots.","Verify cluster-wide Nomad version consistency.","Escalate to Raft recovery if the error persists across restarts."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"func isMissingPlugin(err error) bool {\n    // nil plugin (not an error) means absent; error containing this text means memdb failure\n    return err != nil && strings.Contains(err.Error(), \"csi_plugin lookup failed\")\n}","tryCatchPattern":"plug, err := store.CSIPluginByID(ws, ns, id)\nswitch {\ncase err == nil && plug != nil: // found\ncase err == nil && plug == nil: // absent — treat as not-found, not error\ncase strings.Contains(err.Error(), \"lookup failed\"): // memdb failure — escalate\n    return err\n}","preventionTips":["Distinguish not-found (nil, nil) from lookup errors before handling","Treat repeated lookup failures as state-store corruption signals","Restart server and verify with nomad operator debug if persistent","Keep versions aligned across servers"],"tags":["nomad","state-store","csi","plugin-lookup"],"backgroundTag":"csi-plugin-lookup-failed","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"}