groups list 400 INVALID_ARGUMENT: searchTransitiveGroups rejects `(A || B)` OR label filter
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 8.4k
- Forks
- 697
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 89
Description
Environment
- gog version: v0.38.1 (324f656a 2026-08-26T04:37:04Z)
- Auth: delegated service account (domain-wide delegation), invoked as
--account <workspace-email>
Repro
gog --account admin@example.com groups list
Result:
Google API error (400 badRequest): Request contains an invalid argument.
Root cause
internal/cmd/groups.go → searchTransitiveGroupsQuery builds this query:
return fmt.Sprintf(
"member_key_id == '%s' && ('%s' in labels || '%s' in labels)",
memberKeyID,
groupLabelDiscussionForum, // cloudidentity.googleapis.com/groups.discussion_forum
groupLabelDynamic, // cloudidentity.googleapis.com/groups.dynamic
)
Cloud Identity's groups.memberships.searchTransitiveGroups query accepts && (AND) filters, but the parenthesized || (OR) between two label conditions is rejected with 400 INVALID_ARGUMENT.
Evidence (raw API, varying the query)
| query | HTTP |
|---|---|
member_key_id == 'x@example.com' (no label) |
400 |
member_key_id == 'x@example.com' && 'cloudidentity.googleapis.com/groups.discussion_forum' in labels |
200 |
member_key_id == 'x@example.com' && ('...discussion_forum' in labels || '...dynamic' in labels) |
400 |
Suggested fix
Use a single label filter instead of the OR (e.g. only discussion_forum), or issue two separate queries and merge results. The two-label OR appears to have been introduced by the label-filter change (#315), but the OR form is not accepted by the Cloud Identity API.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in internal/cmd/groups.go at searchTransitiveGroupsQuery and reproduce with gog --account admin@example.com groups list. Check the Cloud Identity query constraints and choose between a single supported label filter or two queries with merged results. Done means the groups list request no longer returns 400 INVALID_ARGUMENT and still finds the intended groups.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, google-cloud
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100