[GH-ISSUE #761] builds add-groups: surface clear error for internal groups instead of opaque API message #204

Closed
opened 2026-02-26 21:33:59 +03:00 by kerem · 0 comments
Owner

Originally created by @mithileshchellappan on GitHub (Feb 24, 2026).
Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/761

Summary

Improve the error message when asc builds add-groups is called with an internal beta group ID, which Apple does not allow.

Problem

Internal TestFlight groups automatically receive all builds — Apple's API does not allow manually adding builds to internal groups. When an agent attempts this:

asc builds add-groups \
  --build 4d23cb4c-3f72-4af0-9393-19a06677622f \
  --group 7b3fe3c0-7d1c-4550-95b4-302d95aca70b  # internal group

The error returned is:

Error: builds add-groups: failed to add groups: Builds cannot be assigned to this internal group.: Cannot add internal group to a build.

While this does mention "internal group", the error is a raw pass-through from the ASC API. For an agent-first CLI, this could be improved with:

  1. Actionable context — explain why it failed and what to do instead
  2. A --skip-internal flag — gracefully skip internal groups in mixed group lists

Current Behavior

When passing a comma-separated list of group IDs (mix of internal and external), the entire operation fails if any group is internal. The agent must then filter groups itself, requiring an extra beta-groups get call per group to check the isInternalGroup attribute.

Proposal

Better error message

Error: Cannot add build to group "Friends & Family" (7b3fe3c0-...): this is an internal 
beta group. Internal groups automatically receive all processed builds.

Hint: Use --skip-internal to silently skip internal groups, or remove internal group IDs 
from the --group list.

New flag: --skip-internal

# Mixed group list — skip internal, add external only
asc builds add-groups \
  --build BUILD_ID \
  --group "INTERNAL_ID,EXTERNAL_ID" \
  --skip-internal

Behavior:

  1. Before making the API call, fetch group metadata for each provided group ID
  2. Filter out groups where isInternalGroup == true
  3. Proceed with remaining external groups only
  4. Log skipped groups to stderr: Skipped internal group "Friends & Family" (builds are auto-distributed)

Scope

  • internal/cli/builds/builds_add_groups.go: add --skip-internal flag, pre-filter logic, improved error formatting
  • Tests: internal-only list (no-op with flag), mixed list, flag-off behavior unchanged

Acceptance Criteria

  • Without --skip-internal: error message includes actionable hint about internal groups
  • With --skip-internal: internal groups are silently skipped, external groups are added
  • With --skip-internal and only internal groups: exits 0 with informational stderr message
  • Existing behavior unchanged when all groups are external
  • Tests pass with ASC_BYPASS_KEYCHAIN=1

Use Case

Agents often discover group IDs dynamically (e.g., "add to all groups for this app"). Without --skip-internal, the agent needs to pre-filter groups itself, adding complexity and extra API calls to what should be a single command.

Originally created by @mithileshchellappan on GitHub (Feb 24, 2026). Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/761 ## Summary Improve the error message when `asc builds add-groups` is called with an internal beta group ID, which Apple does not allow. ## Problem Internal TestFlight groups automatically receive all builds — Apple's API does not allow manually adding builds to internal groups. When an agent attempts this: ```bash asc builds add-groups \ --build 4d23cb4c-3f72-4af0-9393-19a06677622f \ --group 7b3fe3c0-7d1c-4550-95b4-302d95aca70b # internal group ``` The error returned is: ``` Error: builds add-groups: failed to add groups: Builds cannot be assigned to this internal group.: Cannot add internal group to a build. ``` While this does mention "internal group", the error is a raw pass-through from the ASC API. For an agent-first CLI, this could be improved with: 1. **Actionable context** — explain _why_ it failed and what to do instead 2. **A `--skip-internal` flag** — gracefully skip internal groups in mixed group lists ## Current Behavior When passing a comma-separated list of group IDs (mix of internal and external), the entire operation fails if any group is internal. The agent must then filter groups itself, requiring an extra `beta-groups get` call per group to check the `isInternalGroup` attribute. ## Proposal ### Better error message ``` Error: Cannot add build to group "Friends & Family" (7b3fe3c0-...): this is an internal beta group. Internal groups automatically receive all processed builds. Hint: Use --skip-internal to silently skip internal groups, or remove internal group IDs from the --group list. ``` ### New flag: `--skip-internal` ```bash # Mixed group list — skip internal, add external only asc builds add-groups \ --build BUILD_ID \ --group "INTERNAL_ID,EXTERNAL_ID" \ --skip-internal ``` Behavior: 1. Before making the API call, fetch group metadata for each provided group ID 2. Filter out groups where `isInternalGroup == true` 3. Proceed with remaining external groups only 4. Log skipped groups to stderr: `Skipped internal group "Friends & Family" (builds are auto-distributed)` ## Scope - `internal/cli/builds/builds_add_groups.go`: add `--skip-internal` flag, pre-filter logic, improved error formatting - Tests: internal-only list (no-op with flag), mixed list, flag-off behavior unchanged ## Acceptance Criteria - Without `--skip-internal`: error message includes actionable hint about internal groups - With `--skip-internal`: internal groups are silently skipped, external groups are added - With `--skip-internal` and only internal groups: exits 0 with informational stderr message - Existing behavior unchanged when all groups are external - Tests pass with `ASC_BYPASS_KEYCHAIN=1` ## Use Case Agents often discover group IDs dynamically (e.g., "add to all groups for this app"). Without `--skip-internal`, the agent needs to pre-filter groups itself, adding complexity and extra API calls to what should be a single command.
kerem closed this issue 2026-02-26 21:34:00 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/App-Store-Connect-CLI#204
No description provided.