{"record":{"id":"f21ddec2eb10fc2c","repo":"langchain-ai/deepagents","slug":"google-cloud-location-is-required-for-provider-go","errorCode":null,"errorMessage":"Google Cloud location is required for provider 'google_anthropic_vertex'. Set GOOGLE_CLOUD_LOCATION or DEEPAGENTS_CODE_GOOGLE_CLOUD_LOCATION, or pass 'location' in model params.","messagePattern":"Google Cloud location is required for provider 'google_anthropic_vertex'\\. Set GOOGLE_CLOUD_LOCATION or DEEPAGENTS_CODE_GOOGLE_CLOUD_LOCATION, or pass 'location' in model params\\.","errorType":"exception","errorClass":"ModelConfigError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/config.py","lineNumber":5309,"sourceCode":"    Raises:\n        ModelConfigError: If no location is configured.\n    \"\"\"\n    if provider != \"google_anthropic_vertex\":\n        return\n    credentials = _get_credentials()\n    if credentials.google_cloud_project:\n        kwargs.setdefault(\"project\", credentials.google_cloud_project)\n    if credentials.google_cloud_location:\n        kwargs.setdefault(\"location\", credentials.google_cloud_location)\n    if not kwargs.get(\"location\"):\n        from deepagents_code.model_config import ModelConfigError\n\n        msg = (\n            \"Google Cloud location is required for provider \"\n            \"'google_anthropic_vertex'. Set GOOGLE_CLOUD_LOCATION or \"\n            \"DEEPAGENTS_CODE_GOOGLE_CLOUD_LOCATION, or pass 'location' in model params.\"\n        )\n        raise ModelConfigError(msg)\n\n\ndef _compose_openai_reasoning_effort(\n    provider: str,\n    kwargs: dict[str, Any],\n    effort_override: object,\n    reasoning_override: object,\n) -> dict[str, Any]:\n    \"\"\"Compose a session effort override with an OpenAI reasoning mapping.\n\n    Args:\n        provider: Resolved model provider.\n        kwargs: Layered model constructor parameters.\n        effort_override: High-priority `reasoning_effort` from session params.\n        reasoning_override: High-priority native `reasoning` from session params.\n\n    Returns:\n        Constructor parameters with one native `reasoning` mapping when","sourceCodeStart":5291,"sourceCodeEnd":5327,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/config.py#L5291-L5327","documentation":"Raised when configuring the `google_anthropic_vertex` provider (Claude on Vertex AI) without a Google Cloud location. Vertex requires a project and a region; the library injects them from stored credentials or config params via `_apply_google_anthropic_vertex_kwargs` and refuses to guess the region. GCP endpoints are region-specific, so there is no safe default.","triggerScenarios":"Creating a model with provider `google_anthropic_vertex` when, after merging stored credentials and config.toml `params`, `kwargs` still has no `location`: GOOGLE_CLOUD_LOCATION and DEEPAGENTS_CODE_GOOGLE_CLOUD_LOCATION are unset and no `location` appears in model params (config.py:5294-5309).","commonSituations":"Authenticating via Application Default Credentials where the project is detected but the region is not; CI environments with only GOOGLE_CLOUD_PROJECT set; copying a working config from another region without mirroring the location.","solutions":["Set `export GOOGLE_CLOUD_LOCATION=us-east5` (or your region)","Set DEEPAGENTS_CODE_GOOGLE_CLOUD_LOCATION as the app-specific override","Pass `location` in model params: `[providers.\"google_anthropic_vertex\".params] location = \"us-east5\"` in config.toml or as a model kwarg"],"exampleFix":"// before\n$ dcode -m google_anthropic_vertex:claude-sonnet-4\nModelConfigError: Google Cloud location is required...\n\n// after\n$ export GOOGLE_CLOUD_PROJECT=my-project\n$ export GOOGLE_CLOUD_LOCATION=us-east5\n$ dcode -m google_anthropic_vertex:claude-sonnet-4","handlingStrategy":"validation","validationCode":"import os\ndef vertex_location_ok() -> bool:\n    return bool(\n        os.environ.get(\"GOOGLE_CLOUD_LOCATION\")\n        or os.environ.get(\"DEEPAGENTS_CODE_GOOGLE_CLOUD_LOCATION\")\n    )","typeGuard":null,"tryCatchPattern":"from deepagents_code.model_config import ModelConfigError\ntry:\n    model = create_model(\"google_anthropic_vertex:claude-sonnet-4\")\nexcept ModelConfigError as e:\n    if \"location is required\" in str(e):\n        os.environ.setdefault(\"GOOGLE_CLOUD_LOCATION\", \"us-east5\")\n        model = create_model(\"google_anthropic_vertex:claude-sonnet-4\")\n    else:\n        raise","preventionTips":["Always set GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION together for Vertex","Put `location` in the provider's `params` table in config.toml for team-wide configs","Match the region to one where the Claude models are available"],"tags":["gcp","vertex-ai","config","env-var"],"backgroundTag":"missing-env-var","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}