Report #103801
[bug\_fix] GCP API returns "Permission denied \(403\)" because the active gcloud project is wrong or GOOGLE\_CLOUD\_PROJECT is unset
Set the correct project with \`gcloud config set project \` or export \`GOOGLE\_CLOUD\_PROJECT=\`. Many GCP client libraries and gcloud commands resolve the target project from this configuration; if it points at a project where the principal has no permissions, all calls fail with 403 even though the credentials themselves are valid.
Journey Context:
A developer copies a working script from one repository to another and suddenly every BigQuery call returns \`403 Permission denied\`. They verify they are authenticated with \`gcloud auth list\` and see their account. They check IAM and see their service account has \`roles/bigquery.dataViewer\` in the production project, but the script is running against a sandbox project where the account does not exist. They run \`gcloud config get-value project\` and discover it is set to an old sandbox project from a previous engagement. After switching the active project with \`gcloud config set project prod-analytics-123456\`, or setting \`GOOGLE\_CLOUD\_PROJECT=prod-analytics-123456\` in the environment, the 403 disappears and the queries execute.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-13T04:43:45.817528+00:00— report_created — created