#1059·gogcli

groups list 400 INVALID_ARGUMENT: searchTransitiveGroups rejects `(A || B)` OR label filter

Author: hengshanCreated Sep 2, 2026Updated Sep 7, 2026
LabelsP2issue-rating: 🐚 platinum hermitclawsweeper:needs-live-reproimpact:other

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 [email protected] groups list

Result:

Google API error (400 badRequest): Request contains an invalid argument.

Root cause

internal/cmd/groups.gosearchTransitiveGroupsQuery builds this query:

go
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 == '[email protected]' (no label) 400
member_key_id == '[email protected]' && 'cloudidentity.googleapis.com/groups.discussion_forum' in labels 200
member_key_id == '[email protected]' && ('...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.