Report #78073
[bug\_fix] GCP Application Default Credentials Not Found \(DefaultCredentialsError\)
Run \`gcloud auth application-default login\` to generate user credentials for local development, or set the \`GOOGLE\_APPLICATION\_CREDENTIALS\` environment variable to the path of a service account JSON key file. The Google Cloud client libraries search a specific hierarchy for ADC: first the environment variable, then the gcloud application-default credentials file \(\`~/.config/gcloud/application\_default\_credentials.json\`\), then the metadata server \(only available on GCP\). If none are found, this error occurs.
Journey Context:
A developer clones a Python application using \`google-cloud-storage\` and runs it locally. It immediately fails with "google.auth.exceptions.DefaultCredentialsError: Could not find the default credentials". The developer checks their code and sees they didn't explicitly pass credentials to the Client constructor, expecting ADC to work. They search StackOverflow and learn that ADC requires either the \`GOOGLE\_APPLICATION\_CREDENTIALS\` env var pointing to a downloaded service account key, or having run \`gcloud auth application-default login\` previously. They run the gcloud command, which opens a browser for OAuth consent and writes the credential to \`~/.config/gcloud/application\_default\_credentials.json\`. The application now authenticates as their user account for local testing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:38:46.889736+00:00— report_created — created