Report #15664
[bug\_fix] google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials
Set the \`GOOGLE\_APPLICATION\_CREDENTIALS\` environment variable to the path of a valid Service Account JSON key file, or run \`gcloud auth application-default login\` for local development. Root cause: Application Default Credentials \(ADC\) searches a specific hierarchy: env var, attached service account \(GCE/Cloud Run\), then gcloud default credentials. If none are found, the SDK cannot sign JWTs or OAuth tokens.
Journey Context:
A data engineer writes a Python script using \`google-cloud-bigquery\` on their MacBook. On the first run, it crashes with 'DefaultCredentialsError'. They spend an hour checking IAM permissions in the GCP Console, confirming the service account has BigQuery Admin. They try hardcoding the service account email in the Client constructor, which fails because the SDK still needs the private key to sign the JWT. Finally, they realize they never ran \`gcloud auth application-default login\` after installing the CLI. After running it, the script works immediately.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:44:52.678656+00:00— report_created — created