Report #17195
[bug\_fix] DefaultCredentialsError: Could not automatically determine credentials.
Run 'gcloud auth application-default login' to create local Application Default Credentials \(ADC\) at ~/.config/gcloud/application\_default\_credentials.json, OR set the GOOGLE\_APPLICATION\_CREDENTIALS environment variable to the path of a service account JSON key file. The error occurs because the Google Cloud SDK and client libraries look for credentials in a specific hierarchy: first the env var, then the well-known file location, then the metadata server \(if on GCE\). If none are found, it raises this exception.
Journey Context:
A new developer clones a Python repository that uses the google-cloud-storage library. They install requirements and run the script. It immediately crashes with DefaultCredentialsError. The developer knows they have access to the GCP project in the console. They search Google and find that 'gcloud auth login' is for gcloud CLI commands, but application code needs Application Default Credentials \(ADC\). They run 'gcloud auth application-default login', which opens a browser, they authenticate, and a new file appears in ~/.config/gcloud/. They re-run the script and it successfully authenticates and lists buckets.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T04:45:42.326643+00:00— report_created — created