[Bug] UserDAO.listCount fails with "Missing named parameter 'domainEntityType'" on PostgreSQL - Settings > Users page returns 500
Affected module Backend Describe the bug UserDAO.listCount throws a Missing named parameter 'domainEntityType' exception when listing users. The SQL query references :domainEntityType as a named bind parameter but the calling code does not bind it, causing all user listing API calls that involve domain filtering to fail with a 500 error. Full exception: Missing named parameter 'domainEntityType' in binding: {positional:{4:10}, named:{team:null,relation:10}, finder:[]}
statement:"/* UserDAO.listCount */ SELECT count(id) FROM ( SELECT ue.id FROM user_entity ue LEFT JOIN entity_relationship er on ue.id = er.toId LEFT JOIN team_entity te on te.id = er.fromId and er.relation = :relation WHERE ue.deleted = FALSE AND (ue.id NOT IN ( SELECT entity_relationship.toId FROM entity_relationship WHERE entity_relationship.fromEntity='domain' AND entity_relationship.toEntity = :domainEntityType AND relation=10 )) AND (ue.json#>'{isAdmin}' IS NULL OR ((ue.json#>'{isAdmin}')::boolean) = FALSE) AND (ue.json#>'{isBot}' IS NULL OR ((ue.json#>'{isBot}')::boolean) = FALSE) AND (:team IS NULL OR te.nameHash = :team) GROUP BY ue.id) subquery" To Reproduce
Deploy OpenMetadata 1.12.3 with PostgreSQL backend Navigate to Settings → Users in the UI The page fails to load and the backend logs show the above exception
Expected behavior The Users listing page should load successfully. The :domainEntityType parameter should be bound in the JDBI query call — its value should be "user" based on the query context (filtering users not belonging to any domain). Version
OS: Ubuntu 24.04 (Azure VM, Docker Compose deployment) Python version: N/A (backend issue) OpenMetadata version: 1.12.3 OpenMetadata Ingestion package version: N/A (not using bundled ingestion container) Database: PostgreSQL (external, Azure hosted) Elasticsearch: 9.3.0
Additional context
This only occurs with the PostgreSQL backend. MySQL behavior unknown. The parameter :domainEntityType appears in the WHERE subquery for domain exclusion filtering but is never added to the JDBI binding map in the calling service layer. Workaround: upgrade to 1.12.4 if the fix is included there, or manually bind domainEntityType to "user" in UserDAO.java. Related file: openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserDAO.java
hey @harshach could you assign it to me
Please assign this to me. I have already submitted a PR for the WeMakeDevs hackathon to fix it.
Hello. I am working on this through PR #27252 for the WeMakeDevs Hackathon. Please assign me and review when available.
hi there is any news on this issue?
Still reproducible on 2.0, and on MySQL as well — so this is not PostgreSQL-specific.
There is a second variant of the same bug: the branch that fires when the user
does have domains assigned. In that case the query builds
:domainId_0..:domainId_n placeholders which are never bound either.
Environment
- OpenMetadata version: 2.0
- Database: MySQL
- Reproduced as a non-admin user with the
Domain Only Access Roleassigned (policy:Domain Only Access Policy)
Steps to reproduce
- Assign the
Domain Only Access Role(which carries theDomain Only Access Policy) to a user. - Assign one or more domains to that user.
- Log in as that user and open Settings → Users.
- The page fails to load; the backend returns a 500.
Expected behavior
The Users page should list only the users belonging to the caller's domain(s).
Actual behavior
An exception with message [Missing named parameter 'domainId_0' in binding:{positional:{4:10}, named:{team:null,relation:10}, finder:[]} [statement:"/* UserDAO.listCount */ SELECT count(id) FROM (SELECT ue.id FROM user_entity ue LEFT JOIN entity_relationship er on ue.id = er.toId LEFT JOIN team_entity te on te.id = er.fromId and er.relation = :relation WHERE ue.deleted = FALSE AND (NOT EXISTS (SELECT 1 FROM entity_relationship er WHERE er.relation=10 AND er.fromEntity='domain' AND er.toId = ue.id) OR ue.id IN (SELECT er2.toId FROM entity_relationship er2 WHERE er2.fromEntity='domain' AND er2.fromId IN (:domainId_0,:domainId_1,:domainId_2) AND er2.relation=10)) AND (JSON_EXTRACT(ue.json, '$.isAdmin') IS NULL OR JSON_EXTRACT(ue.json, '$.isAdmin') = FALSE ) AND (JSON_EXTRACT(ue.json, '$.isBot') IS NULL OR JSON_EXTRACT(ue.json, '$.isBot') = FALSE ) AND (:team IS NULL OR te.nameHash = :team) GROUP BY ue.id) subquery", arguments:{positional:{4:10}, named:{team:null,relation:10}, finder:[]}]] was thrown while processing request.
Hello @TeddyCr Is there is any Update on this bug?