{"record":{"id":"2fa7b63ca2d96d7c","repo":"hashicorp/nomad","slug":"acl-role-deletion-failed-v","errorCode":null,"errorMessage":"ACL role deletion failed: %v","messagePattern":"ACL role deletion failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/state/state_store_acl.go","lineNumber":217,"sourceCode":"\treturn txn.Commit()\n}\n\n// deleteACLRoleByIDTxn deletes a single ACL role from the state store using the\n// provided write transaction. It is the responsibility of the caller to update\n// the index table.\nfunc (s *StateStore) deleteACLRoleByIDTxn(txn *txn, roleID string) error {\n\n\texisting, err := txn.First(TableACLRoles, indexID, roleID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ACL role lookup failed: %v\", err)\n\t}\n\tif existing == nil {\n\t\treturn errors.New(\"ACL role not found\")\n\t}\n\n\t// Delete the existing entry from the table.\n\tif err := txn.Delete(TableACLRoles, existing); err != nil {\n\t\treturn fmt.Errorf(\"ACL role deletion failed: %v\", err)\n\t}\n\treturn nil\n}\n\n// GetACLRoles returns an iterator that contains all ACL roles stored within\n// state.\nfunc (s *StateStore) GetACLRoles(ws memdb.WatchSet) (memdb.ResultIterator, error) {\n\ttxn := s.db.ReadTxn()\n\n\t// Walk the entire table to get all ACL roles.\n\titer, err := txn.Get(TableACLRoles, indexID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ACL role lookup failed: %v\", err)\n\t}\n\tws.Add(iter.WatchCh())\n\n\treturn iter, nil\n}","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/state/state_store_acl.go#L199-L235","documentation":"Returned by deleteACLRoleByIDTxn when txn.Delete fails to remove an existing ACL role row from the acl_roles table. It wraps the underlying memdb delete error; the role was confirmed to exist just before.","triggerScenarios":"memdb txn.Delete(TableACLRoles, existing) errors during DeleteACLRolesByID — typically an object not matching the table schema or an internal memdb failure.","commonSituations":"Corrupted state store entries (e.g. restored objects of wrong type); bugs after version migrations.","solutions":["Inspect the wrapped error message for the memdb root cause.","Verify state store integrity; restore from a Nomad snapshot if entries are corrupt.","Ensure all server agents run the same Nomad version (rolling upgrades done correctly)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"role, err := client.ACLRoles().Get(roleID); if err != nil { return err }","typeGuard":null,"tryCatchPattern":"if err := deleteRole(id); err != nil {\n    if strings.Contains(err.Error(), \"ACL role deletion failed\") { retryWithBackoff(...) }\n}","preventionTips":["Verify the role exists before deleting","Keep server versions aligned","Restore from snapshot on repeated errors"],"tags":["nomad","state-store","acl","memdb"],"backgroundTag":"state-store-delete-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"}