{"record":{"id":"9ac4ce50e501cac4","repo":"hashicorp/nomad","slug":"variable-lookup-failed-v","errorCode":null,"errorMessage":"variable lookup failed: %v","messagePattern":"variable lookup failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/state/state_store_variables.go","lineNumber":48,"sourceCode":"\n\tws.Add(iter.WatchCh())\n\treturn iter, nil\n}\n\n// GetVariablesByNamespace returns an iterator that contains all\n// variables belonging to the provided namespace.\nfunc (s *StateStore) GetVariablesByNamespace(\n\tws memdb.WatchSet, namespace string) (memdb.ResultIterator, error) {\n\ttxn := s.db.ReadTxn()\n\treturn s.getVariablesByNamespaceImpl(txn, ws, namespace)\n}\n\nfunc (s *StateStore) getVariablesByNamespaceImpl(\n\ttxn *txn, ws memdb.WatchSet, namespace string) (memdb.ResultIterator, error) {\n\t// Walk the entire table.\n\titer, err := txn.Get(TableVariables, indexID+\"_prefix\", namespace, \"\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"variable lookup failed: %v\", err)\n\t}\n\tws.Add(iter.WatchCh())\n\n\treturn iter, nil\n}\n\n// GetVariablesByNamespaceAndPrefix returns an iterator that contains all\n// variables belonging to the provided namespace that match the prefix.\nfunc (s *StateStore) GetVariablesByNamespaceAndPrefix(\n\tws memdb.WatchSet, namespace, prefix string) (memdb.ResultIterator, error) {\n\ttxn := s.db.ReadTxn()\n\n\t// Walk the entire table.\n\titer, err := txn.Get(TableVariables, indexID+\"_prefix\", namespace, prefix)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"variable lookup failed: %v\", err)\n\t}\n\tws.Add(iter.WatchCh())","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/state/state_store_variables.go#L30-L66","documentation":"Iterating the variables table by namespace prefix failed in memdb; the wrapped txn.Get error means the state store could not enumerate variables for the namespace.","triggerScenarios":"Thrown at nomad/state/state_store_variables.go:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the variables listing/deletion","Check server logs for state store errors","Verify server health"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}