claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Every bash command with Google Vertex seems to get stuck before executing

Open gboston opened this issue 7 months ago • 8 comments

Environment

  • Platform (select one):
    • [ ] Anthropic API
    • [ ] AWS Bedrock
    • [x] Google Vertex AI
    • [x] Other: LiteLLM (pass through vertex AI)
  • Claude CLI version: 1.0.3
  • Operating System: MacOS 15.5
  • Terminal: Iterm2

Bug Description

Bash tool seems to be hanging for 1-2min for simple commands. This doesn't seem to be the case when using Anthropic directly.

Steps to Reproduce

  1. Ask to validate script eg. scripts.sh
  2. Bash (bash -n ./scripts.sh)

Expected Behavior

Immediate request to proceed with 1. yes 2. Yes, and don't ask again 3. No and tell something differently

Actual Behavior

Hangs for 160s before requesting if we can proceed

Additional Context

Image

gboston avatar May 28 '25 07:05 gboston

I am also experiencing this issue and can replicate following the steps outlined above

JasonAPelletier avatar May 29 '25 20:05 JasonAPelletier

Also experiencing this issue and it's a pain

ArickHanna14 avatar Jun 03 '25 17:06 ArickHanna14

@JasonAPelletier & @ArickHanna14 same environment configuration?

gboston avatar Jun 03 '25 17:06 gboston

Yes, Google Vertex AI

ArickHanna14 avatar Jun 03 '25 17:06 ArickHanna14

Can you set env var ANTHROPIC_LOG=debug and see if you have a request to the ANTHROPIC_SMALL_FAST_MODEL hanging or failing? This is a "pre-flight" check done before BashTool moves forward.

ant-kurt avatar Jun 04 '25 19:06 ant-kurt

So I am seeing the following in the logs, attempting to hit these urls over and over failing with a 429:

[log_5efd4d] post https://europe-west1-aiplatform.googleapis.com/v1/projects/crv-engineering-ai-prd-8058/locations/europe-west1/publishers/anthropic/models/claude-3-5-haiku@20241022:streamRawPredict failed with status 429 in 179ms - error; no more retries left [log_5efd4d] response error (error; no more retries left) { url: 'https://europe-west1-aiplatform.googleapis.com/v1/projects/crv-engineering-ai-prd-8058/locations/europe-west1/publishers/anthropic/models/claude-3-5-haiku@20241022:streamRawPredict', status: 429, headers: { 'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', 'content-encoding': 'gzip', 'content-type': 'application/json; charset=UTF-8', date: 'Wed, 04 Jun 2025 22:19:13 GMT', server: 'scaffolding on HTTPServer2', 'transfer-encoding': 'chunked', vary: 'Origin, X-Origin, Referer', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '0' }, message: undefined, durationMs: 183 } [log_14c374] sending request { method: 'post', url: 'https://europe-west1-aiplatform.googleapis.com/v1/projects/crv-engineering-ai-prd-8058/locations/europe-west1/publishers/anthropic/models/claude-3-5-haiku@20241022:streamRawPredict', options: { method: 'post', path: '/projects/crv-engineering-ai-prd-8058/locations/europe-west1/publishers/anthropic/models/claude-3-5-haiku@20241022:streamRawPredict', body: { model: undefined, max_tokens: 512, messages: [Array], system: [Array], temperature: 1, metadata: [Object], stream: true, anthropic_version: 'vertex-2023-10-16' }, timeout: 60000, signal: AbortSignal { aborted: false }, stream: true }, headers: { accept: 'application/json', 'anthropic-dangerous-direct-browser-access': 'true', 'anthropic-version': '2023-06-01', authorization: '', 'content-type': 'application/json', 'user-agent': 'claude-cli/1.0.11 (external, cli)', 'x-app': 'cli', 'x-goog-user-project': 'crv-engineering-ai-prd-8058', 'x-stainless-arch': 'arm64', 'x-stainless-helper-method': 'stream', 'x-stainless-lang': 'js', 'x-stainless-os': 'MacOS', 'x-stainless-package-version': '0.51.0', 'x-stainless-retry-count': '0', 'x-stainless-runtime': 'node', 'x-stainless-runtime-version': 'v23.11.0', 'x-stainless-timeout': '60' } } [log_14c374] post https://europe-west1-aiplatform.googleapis.com/v1/projects/crv-engineering-ai-prd-8058/locations/europe-west1/publishers/anthropic/models/claude-3-5-haiku@20241022:streamRawPredict failed with status 429 in 166ms - error; no more retries left [log_14c374] response error (error; no more retries left) { url: 'https://europe-west1-aiplatform.googleapis.com/v1/projects/crv-engineering-ai-prd-8058/locations/europe-west1/publishers/anthropic/models/claude-3-5-haiku@20241022:streamRawPredict', status: 429, headers: { 'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', 'content-encoding': 'gzip', 'content-type': 'application/json; charset=UTF-8', date: 'Wed, 04 Jun 2025 22:19:15 GMT', server: 'scaffolding on HTTPServer2', 'transfer-encoding': 'chunked', vary: 'Origin, X-Origin, Referer', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '0' }, message: undefined, durationMs: 170 } [log_5e24d6] sending request { method: 'post', url: 'https://europe-west1-aiplatform.googleapis.com/v1/projects/crv-engineering-ai-prd-8058/locations/europe-west1/publishers/anthropic/models/claude-3-5-haiku@20241022:streamRawPredict', options: { method: 'post', path: '/projects/crv-engineering-ai-prd-8058/locations/europe-west1/publishers/anthropic/models/claude-3-5-haiku@20241022:streamRawPredict', body: { model: undefined, max_tokens: 512, messages: [Array], system: [Array], temperature: 0, metadata: [Object], stream: true, anthropic_version: 'vertex-2023-10-16' }, timeout: 60000, signal: AbortSignal { aborted: false }, stream: true }, headers: { accept: 'application/json', 'anthropic-dangerous-direct-browser-access': 'true', 'anthropic-version': '2023-06-01', authorization: '', 'content-type': 'application/json', 'user-agent': 'claude-cli/1.0.11 (external, cli)', 'x-app': 'cli', 'x-goog-user-project': 'crv-engineering-ai-prd-8058', 'x-stainless-arch': 'arm64', 'x-stainless-helper-method': 'stream', 'x-stainless-lang': 'js', 'x-stainless-os': 'MacOS', 'x-stainless-package-version': '0.51.0', 'x-stainless-retry-count': '0', 'x-stainless-runtime': 'node', 'x-stainless-runtime-version': 'v23.11.0', 'x-stainless-timeout': '60' } } [log_5e24d6] post https://europe-west1-aiplatform.googleapis.com/v1/projects/crv-engineering-ai-prd-8058/locations/europe-west1/publishers/anthropic/models/claude-3-5-haiku@20241022:streamRawPredict failed with status 429 in 154ms - error; no more retries left [log_5e24d6] response error (error; no more retries left) { url: 'https://europe-west1-aiplatform.googleapis.com/v1/projects/crv-engineering-ai-prd-8058/locations/europe-west1/publishers/anthropic/models/claude-3-5-haiku@20241022:streamRawPredict', status: 429, headers: { 'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', 'content-encoding': 'gzip', 'content-type': 'application/json; charset=UTF-8', date: 'Wed, 04 Jun 2025 22:19:17 GMT', server: 'scaffolding on HTTPServer2', 'transfer-encoding': 'chunked', vary: 'Origin, X-Origin, Referer', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '0' }, message: undefined, durationMs: 156 }

ArickHanna14 avatar Jun 04 '25 22:06 ArickHanna14

OK - that call needs to succeed before the bash command is able to run. Can you try reducing the number of background Haiku calls going out by setting DISABLE_NON_ESSENTIAL_MODEL_CALLS=1? This should hopefully alleviate the 429.

Unfortunately there is a call to Haiku that is a requirement for BashTool to run, so there is not currently a way to bypass this.

ant-kurt avatar Jun 04 '25 22:06 ant-kurt

So I launched claude with those variables DISABLE_NON_ESSENTIAL_MODEL_CALLS=1 ANTHROPIC_LOG=debug claude and I still see tons of 429s

ArickHanna14 avatar Jun 04 '25 22:06 ArickHanna14

it seems to work once I activate these models on vertex AI and set it to us-east5. Is it possible to use different models that are available on europe-west1?

gboston avatar Jun 05 '25 15:06 gboston

You can set the env var to a model in the supported region (see https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#europe_1), such as ANTHROPIC_SMALL_FAST_MODEL=claude-3-haiku@20240307.

I'll check with the team and see if we can surface these sorts of errors better (though 429 is not what I would expect for region availability issues).

ant-kurt avatar Jun 05 '25 16:06 ant-kurt

Setting that env var works for me and now I'm seeing bash commands execute much faster

ArickHanna14 avatar Jun 05 '25 17:06 ArickHanna14

This indeed fixes the problem. Are there any plans on supporting Opus or 3.5 Haiku in other regions eg. europe-west1? They both give this 429 error on vertex.

gboston avatar Jun 05 '25 17:06 gboston

You may need to reach out to the Google Vertex folks for questions about region support.

Marking this one as closed. Will see if we can improve the error logging here to make the model failures more obvious going forward.

ant-kurt avatar Jun 05 '25 17:06 ant-kurt

Using us-east5 also works for us. Thanks for the help!

ArickHanna14 avatar Jun 05 '25 17:06 ArickHanna14

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 13 '25 14:08 github-actions[bot]