Report #101998
[bug\_fix] A Google Cloud client library fails with \`google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE\_APPLICATION\_CREDENTIALS or explicitly create credentials...\`
Run \`gcloud auth application-default login\` to create \`~/.config/gcloud/application\_default\_credentials.json\`, or set \`GOOGLE\_APPLICATION\_CREDENTIALS\` to the path of a valid service-account/ADC JSON file before starting the process.
Journey Context:
You clone a repo that calls BigQuery or Storage, install the Python packages, and on the first run you hit DefaultCredentialsError. You confirm \`gcloud auth list\` shows your user is logged in, so gcloud itself works, but the code still fails. The confusion comes from the fact that gcloud credentials and Application Default Credentials are two separate caches. ADC looks first at \`GOOGLE\_APPLICATION\_CREDENTIALS\`, then at the well-known ADC file created by \`gcloud auth application-default login\`, and finally at the metadata server on GCP compute. On a local laptop none of those are present by default. Running \`gcloud auth application-default login\` opens a browser, completes an OAuth flow, and writes the ADC file that the Cloud Client Libraries search for automatically. If you are in CI or on a server, you instead export \`GOOGLE\_APPLICATION\_CREDENTIALS\` pointing to a downloaded service-account JSON key or, better, attach a service account to the compute resource so the metadata server supplies credentials.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-08T04:47:51.743892+00:00— report_created — created