Skip to content

[Bug]: Google Vertex AI ADC authentication not working on Windows - "No API key found" #11413

@oranzieus

Description

@oranzieus

Problem

The google-vertex provider fails to authenticate using Google Cloud Application Default Credentials (ADC) on Windows, despite:

  • Valid gcloud ADC credentials
  • GOOGLE_APPLICATION_CREDENTIALS environment variable correctly set
  • gcloud auth application-default print-access-token working correctly
  • Vertex AI API enabled in GCP project

Environment

  • OpenClaw Version: 2026.2.6-3 (85ed6c7)
  • OS: Windows 11
  • Node.js Version: v24.13.0
  • Google Cloud Project: CWR001
  • Google Cloud SDK: Installed and authenticated

Steps to Reproduce

  1. Set up Google Cloud authentication:
gcloud auth application-default login
gcloud config set project CWR001
  1. Verify ADC is working:
# This returns a valid access token
gcloud auth application-default print-access-token

# Verify environment variable
$env:GOOGLE_APPLICATION_CREDENTIALS
# Output: C:\Users\User\AppData\Roaming\gcloud\application_default_credentials.json

# Verify credentials file exists
Test-Path $env:GOOGLE_APPLICATION_CREDENTIALS
# Output: True
  1. Verify Vertex AI API is enabled:
gcloud services list --enabled --filter="name:aiplatform.googleapis.com"
# Output: aiplatform.googleapis.com  Vertex AI API
  1. Configure OpenClaw with google-vertex provider:

Set in ~/.openclaw/openclaw.json:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "google-vertex/gemini-1.5-pro"
      }
    }
  }
}
  1. Try various auth-profiles.json configurations:

All of these failed:

Attempt 1 - No auth profile:

# Deleted auth-profiles.json entirely

Attempt 2 - OAuth type:

{
  "google-vertex:default": {
    "type": "oauth",
    "provider": "google-vertex"
  }
}

Attempt 3 - With profiles wrapper:

{
  "profiles": {
    "google-vertex:default": {
      "provider": "google-vertex",
      "mode": "adc"
    }
  }
}

Attempt 4 - Explicit file path:

{
  "profiles": {
    "google-vertex:default": {
      "provider": "google-vertex",
      "mode": "file",
      "credentials": "C:\\Users\\User\\AppData\\Roaming\\gcloud\\application_default_credentials.json",
      "project": "CWR001",
      "location": "us-central1"
    }
  }
}
  1. Attempt to use OpenClaw:
openclaw agent --agent main --message "Hello test"

Expected Behavior

OpenClaw should:

  1. Detect the ADC credentials from GOOGLE_APPLICATION_CREDENTIALS environment variable
  2. Automatically use them for Vertex AI authentication
  3. Successfully make requests to Vertex AI models

Per the documentation at https://docs.openclaw.ai/concepts/model-providers:

Vertex uses gcloud ADC

Actual Behavior

Error:

FailoverError: No API key found for provider "google-vertex". 
Auth store: C:\Users\User\.openclaw\agents\main\agent\auth-profiles.json 
(agentDir: C:\Users\User\.openclaw\agents\main\agent). 
Configure auth for this agent (openclaw agents add <id>) or copy auth-profiles.json from the main agentDir.

Full error log:

18:56:07 [diagnostic] lane task error: lane=main durationMs=3 error="Error: No API key found for provider "google-vertex". Auth store: C:\Users\User\.openclaw\agents\main\agent\auth-profiles.json (agentDir: C:\Users\User\.openclaw\agents\main\agent). Configure auth for this agent (openclaw agents add <id>) or copy auth-profiles.json from the main agentDir."

Additional Context

Credentials File Contents

gc $env:GOOGLE_APPLICATION_CREDENTIALS | ConvertFrom-Json | Select-Object type, quota_project_id, universe_domain

# Output:
# type            quota_project_id universe_domain
# ----            ---------------- ---------------
# authorized_user CWR001         googleapis.com

OpenClaw Models List Output

openclaw models list
# Shows google-vertex models but with Auth: no

Code Analysis

Looking at src/agents/model-auth.ts in the OpenClaw repository, line 262-268:

if (normalized === "google-vertex") {
    const envKey = getEnvApiKey(normalized);
    if (!envKey) {
      return null;
    }
    return { apiKey: envKey, source: "gcloud adc" };
  }

The code calls getEnvApiKey(normalized) which appears to be looking for credentials, but it's returning null despite the environment being properly configured.

Related Issues

Platform-Specific Notes

This appears to be a Windows-specific issue or a cross-platform ADC detection problem:

  • gcloud CLI works correctly on Windows
  • ADC credentials file exists and is valid
  • Environment variable is set correctly
  • OpenClaw just doesn't detect/use the credentials

Willingness to Help

Happy to provide:

  • Additional debugging information
  • Test any proposed fixes
  • Contribute to PR if guidance is provided

Environment Details

OpenClaw version

Output: 2026.2.6-3 (85ed6c7)

Node.js version

v24.13.0

Windows version

Platform ServicePack Version VersionString


Win32NT 10.0.26100.0 Microsoft Windows NT 10.0.26100.0

gcloud version

Google Cloud SDK 555.0.0
bq 2.1.27
core 2026.01.30
gcloud-crc32c 1.0.0
gsutil 5.35

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions