Permissions → Evaluation crashes with TypeError in useSortedResourceTypes when selecting Groups or Organizations
Before reporting an issue
- I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
admin/ui
Describe the bug
In the admin console, under Permissions → Evaluation, selecting Groups or Organizations as the Resource type crashes the UI with:
Cannot read properties of undefined (reading 'length')The page shows the error alert with a "Reload" link. Selecting Clients, Roles or Users works as expected.
The server data looks correct: the authorization schema returned for the admin-permissions client is complete (see below), and no request fails (no 404 or other error in the Network tab). The crash appears to be purely client-side, in useSortedResourceTypes.
Version
26.7.4 (container image quay.io/keycloak/keycloak:26.7.4)
Regression
- The issue is a regression
Expected behavior
Selecting Groups or Organizations as the resource type in the Evaluation tab shows the corresponding resource/scope fields, so the permission evaluation can be run.
Actual behavior
The UI crashes immediately after selecting Groups or Organizations with TypeError: Cannot read properties of undefined (reading 'length').
Stack trace (browser console):
TypeError: Cannot read properties of undefined (reading 'length')
at useSortedResourceTypes-DKCACjmH.js:1:800
at main-BOcZ02g4.js:18:156877
at ai (react-dom.production.min.js:10:92817)
at Es (react-dom.production.min.js:10:112770)
at react-dom.production.min.js:10:111547
at xs (react-dom.production.min.js:10:111607)
at cs (react-dom.production.min.js:10:105425)
at Ql (react-dom.production.min.js:10:46410)
at react-dom.production.min.js:10:102846How to Reproduce?
- Run
quay.io/keycloak/keycloak:26.7.4 - In a realm, enable Admin Permissions (Realm settings → General)
- Go to Permissions → Evaluation
- Select any user
- Open the Resource type dropdown and select Groups (or Organizations)
- The UI crashes with the error above
- Also reproduced on a freshly created realm
Anything else?
Authorization schema returned by the server for the admin-permissions client (all resource types have a valid scopes array):
"authorizationSchema": {
"resourceTypes": {
"Clients": {
"type": "Clients",
"scopes": ["map-roles", "map-roles-client-scope", "view", "map-roles-composite", "manage"],
"scopeAliases": {}
},
"Organizations": {
"type": "Organizations",
"scopes": ["view", "manage"],
"scopeAliases": {}
},
"Roles": {
"type": "Roles",
"scopes": ["map-role-composite", "map-role", "map-role-client-scope"],
"scopeAliases": {}
},
"Groups": {
"type": "Groups",
"scopes": ["view", "view-members", "manage-membership", "manage", "manage-membership-of-members", "manage-members", "impersonate-members"],
"scopeAliases": {}
},
"Users": {
"type": "Users",
"scopes": ["manage-group-membership", "reset-password", "view", "impersonate", "map-roles", "manage"],
"scopeAliases": {
"manage-group-membership": ["manage-membership-of-members"],
"view": ["view-members"],
"manage": ["manage-members"],
"impersonate": ["impersonate-members"]
},
"groupType": "Groups"
}
}
}Possibly related (same pattern of the UI assuming an array and receiving undefined/null): #52475. In this case, however, no request returns 404.
Source: keycloak/keycloak