Skip to content

Exit Codes

GPC uses semantic exit codes so CI pipelines can distinguish error types and react accordingly.

Exit Code Reference

CodeNameMeaningCI Action
0SuccessCommand completed successfullyContinue pipeline
1General ErrorUnexpected error, unhandled exceptionFail and investigate
2Usage ErrorInvalid arguments, unknown flag, missing required optionFix command syntax
3Auth ErrorNo credentials, expired token, invalid key, revoked accessRe-authenticate or check secrets
4API ErrorGoogle Play API returned an error (rate limit, permission denied, not found, conflict)Check permissions or retry
5Network ErrorDNS failure, timeout, connection refused, proxy errorCheck connectivity
6Threshold BreachVitals metric exceeded the specified thresholdHalt rollout, investigate vitals
10Plugin ErrorPlugin failed to load, invalid permissions, runtime error in pluginCheck plugin config

CI Scripting Patterns

Bash: Branch on Exit Code

bash
gpc releases upload app.aab --track production --rollout 10
EXIT_CODE=$?

case $EXIT_CODE in
  0) echo "Upload successful" ;;
  3) echo "Auth failed — check GPC_SERVICE_ACCOUNT"; exit 1 ;;
  4) echo "API error — check permissions"; exit 1 ;;
  5) echo "Network error — retrying..."; sleep 10; gpc releases upload app.aab --track production --rollout 10 ;;
  6) echo "Vitals threshold breached — halting"; gpc releases rollout halt --track production; exit 1 ;;
  *) echo "Unexpected error (code $EXIT_CODE)"; exit 1 ;;
esac

GitHub Actions: Conditional Steps

yaml
- name: Upload to production
  id: upload
  continue-on-error: true
  run: gpc releases upload app.aab --track production --rollout 10

- name: Handle auth failure
  if: steps.upload.outcome == 'failure' && steps.upload.outputs.exit-code == 3
  run: echo "::error::Authentication failed. Check GPC_SERVICE_ACCOUNT secret."

- name: Handle threshold breach
  if: steps.upload.outcome == 'failure' && steps.upload.outputs.exit-code == 6
  run: |
    echo "::warning::Vitals threshold breached. Halting rollout."
    gpc releases rollout halt --track production

Vitals Gating (Exit Code 6)

bash
# Gate deployment on crash rate
gpc vitals crashes --threshold 2.0
# Exit code 0 = crash rate is below 2.0% — safe to proceed
# Exit code 6 = crash rate is at or above 2.0% — do not proceed

# Gate on multiple metrics
gpc vitals crashes --threshold 2.0 && \
gpc vitals anr --threshold 0.5 && \
echo "All vitals within thresholds" || \
echo "Vitals breached — halting deployment"

JSON Error Format

When an error occurs with --output json, the response follows this structure:

json
{
  "success": false,
  "error": {
    "code": "AUTH_EXPIRED",
    "message": "Access token has expired",
    "suggestion": "Run 'gpc auth login' to re-authenticate"
  }
}

Error Code Prefixes

PrefixCategoryExit Code
AUTH_*Authentication errors3
API_*Google Play API errors4
CONFIG_*Configuration errors1
UPLOAD_*File upload errors1
NETWORK_*Network/connectivity errors5
PLUGIN_*Plugin system errors10

Common Error Codes

CodeCauseFix
AUTH_INVALID_KEYService account JSON is malformedDownload a fresh key from Google Cloud Console
AUTH_FILE_NOT_FOUNDKey file path does not existCheck the path in GPC_SERVICE_ACCOUNT or config
AUTH_TOKEN_FAILEDCould not obtain access tokenVerify key is valid and not revoked
AUTH_EXPIREDAccess token expired and refresh failedRun gpc auth login
API_UNAUTHORIZED401 — invalid or expired tokenRe-authenticate
API_FORBIDDEN403 — insufficient permissionsCheck service account permissions in Play Console
API_NOT_FOUND404 — resource does not existVerify package name and resource IDs
API_EDIT_CONFLICT409 — another edit in progressDelete existing edit and retry
API_RATE_LIMITED429 — too many requestsGPC retries automatically; reduce concurrent requests
API_SERVER_ERROR5xx — Google server errorGPC retries automatically
API_TIMEOUTRequest exceeded timeoutIncrease GPC_TIMEOUT or check network
API_NETWORK_ERRORConnection failedCheck internet connection and proxy settings
CONFIG_INVALIDConfig file has invalid schemaRun gpc config show to see resolved config
PLUGIN_INVALID_PERMISSIONPlugin requests unknown permissionCheck plugin manifest

Released under the MIT License.