CatalogClient.queryEntities() uses GET regardless of filter size, causing URL-length failures for users with many group memberships
Search Terms
UserListPicker useOwnedEntitiesCount relations.ownedBy URL too long ERR_HTTP2_PROTOCOL_ERROR 414 queryEntities GET POST
Project Area
Catalog
Description & Context
UserListPicker unconditionally renders a hidden "Owned" count by calling the useOwnedEntitiesCount() hook. The hook fetches all ownershipEntityRefs from the identity API (all groups the user belongs to) and passes them as repeated relations.ownedBy query parameters to catalogApi.queryEntities():
GET /api/catalog/entities/by-query?limit=0
&filter=kind=template
&filter=relations.ownedBy=user:default/alice
&filter=relations.ownedBy=group:default/team-a
&filter=relations.ownedBy=group:default/team-b
... (hundreds of entries for users in many groups)Because CatalogClient.queryEntities() always serializes filters as GET query parameters, the resulting URL can easily exceed 8-16 KB. This triggers ERR_HTTP2_PROTOCOL_ERROR or net::ERR_CONNECTION_CLOSED in the browser. Since this is a connection-level HTTP/2 error, it also kills subsequent unrelated requests on the same page - not just the failing one.
This happens on every page that renders UserListPicker:
/create(Scaffolder) - notably, the component is configured withavailableFilters={["all", "starred"]}, meaning the "Owned" count is never shown to the user, yet the expensive and problematic request is always made/catalog- viaDefaultFilters/docs- viaDefaultTechDocsHome
Verified on @backstage/catalog-client + @backstage/plugin-catalog-react v3.2.0 (Backstage 1.53.0).
Expected Behavior
Requests to /api/catalog/entities/by-query should not fail for users who belong to many groups. Either the client should not produce unbounded GET URLs, or the server should accept the same filter format via POST body.
Proposed Fix
The proper fix belongs at the transport layer in CatalogClient.queryEntities(): when the serialized filter parameters would produce a URL exceeding a safe threshold (e.g. 2000 characters), the method should fall back to a POST /api/catalog/entities/by-query request with the filter payload in the request body. This would require the backend to expose the same key-value filter format via POST - without changing the filter semantics. The fix would be fully transparent to all callers including useOwnedEntitiesCount.
Workaround
As a short-term workaround, UserListPicker can be omitted from the filter panel on affected pages. The component does not expose a way to disable the useOwnedEntitiesCount() call without removing it entirely, so the only option is to replace DefaultFilters / DefaultTechDocsHome / the Scaffolder's built-in filter panel with custom equivalents that exclude UserListPicker. Additionally, useOwnedEntitiesCount could be made conditional - only calling queryEntities when the "owned" filter is actually included in availableFilters.
Willing to submit PR?
I can help review or advise, but I am not in a position to submit the PR myself.
Source: backstage/backstage