Skip to content

[BUG] AWS Bedrock "Interruped by user" #714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
joennlae opened this issue Apr 5, 2025 · 12 comments
Open
1 task done

[BUG] AWS Bedrock "Interruped by user" #714

joennlae opened this issue Apr 5, 2025 · 12 comments
Labels
bug Something isn't working

Comments

@joennlae
Copy link

joennlae commented Apr 5, 2025

Environment

  • Platform (select one):
    • AWS Bedrock
  • Claude CLI version: 0.2.64
  • Operating System: Ubuntu 24.04
  • Terminal: Vscode Terminal

Bug Description

I did aws configure and tested if I can call the aws bedrock endpoints via this script.

import boto3
# aws bedrock list-foundation-models --region eu-central-1 --query "modelSummaries[*].modelId"

def test_bedrock_converse():
    try:
        # Initialize the Bedrock runtime client
        client = boto3.client('bedrock-runtime', region_name='eu-central-1')  # Replace with your region

        # Define the conversation messages
        user_message = [{"text": "Write a short poem about nature."}]
        
        # Prepare the messages list
        messages = [
            # {"role": "system", "content": system_prompt},
            {"role": "user", "content": user_message}
        ]

        # Invoke the Converse API
        # large model: arn:aws:bedrock:eu-central-1:XXXXXXXXXX:inference-profile/eu.anthropic.claude-3-7-sonnet-20250219-v1:0
        response = client.converse(
            modelId='arn:aws:bedrock:eu-central-1:XXXXXXXXX:inference-profile/eu.anthropic.claude-3-5-sonnet-20240620-v1:0',  # Replace with your model ID
            messages=messages
        )

        print("Response:", response)
        response = response["output"]

        # Extract and print the model's response
        assistant_message = response['message']  # Get the last message (from assistant)
        print("Assistant Response:")
        print(assistant_message['content'])

    except Exception as e:
        print(f"An error occurred: {e}")

# Run the test function
test_bedrock_converse()

This work for both models.

Now I start claude code like this:

ANTHROPIC_MODEL='arn:aws:bedrock:eu-central-1:XXXXXXXXXX:inference-profile/eu.anthropic.claude-3-7-sonnet-20250219-v1:0' \
ANTHROPIC_SMALL_FAST_MODEL='arn:aws:bedrock:eu-central-1:XXXXXXXXXX:inference-profile/eu.anthropic.claude-3-5-sonnet-20240620-v1:0' \
CLAUDE_CODE_USE_BEDROCK=1 \
DISABLE_PROMPT_CACHING=1 DEBUG=1 \
claude --verbose --debug

I always get an Interrupted by user for any command.

> why
  ⎿  Interrupted by user

I also tried to set then env variable via claude config set --global env and removed them again.

Configs

Local config:

claude config list
{
  "allowedTools": [],
  "dontCrawlDirectory": false,
  "hasTrustDialogAccepted": true,
  "hasCompletedProjectOnboarding": true,
  "ignorePatterns": []
}

Global config:

claude config list --global
{
  "autoUpdaterStatus": "enabled",
  "theme": "dark",
  "verbose": false,
  "preferredNotifChannel": "auto",
  "shiftEnterKeyBindingInstalled": true,
  "editorMode": "normal",
  "autoCompactEnabled": true,
  "diffTool": "terminal",
  "env": {}
}

So nothing should overwrite it.

Any help would be appreciated :-)

@joennlae joennlae added the bug Something isn't working label Apr 5, 2025
@malginin
Copy link

malginin commented Apr 8, 2025

Escape the slash in ARN like so #297 (comment)

@joennlae
Copy link
Author

joennlae commented Apr 8, 2025

Escape the slash in ARN like so #297 (comment)

Thank you for the tip. I already tried that. No change on my side.

@sdcampbell
Copy link

sdcampbell commented Apr 8, 2025

I'm now having the same problem. I don't understand why considering the same command was working for me before. I also tried replacing the / with %2F and that didn't work.

I've tested this on MacOS and Debian Linux (ARM64) and both have the same issue.

@sdcampbell
Copy link

I also tried using the following command to set the environment for Claude Code and still got the error:

claude config set --global env '{"CLAUDE_CODE_USE_BEDROCK": "true", "ANTHROPIC_MODEL": "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-7-sonnet-20250219-v1:0"}'

@sdcampbell
Copy link

This problem is all over the place, as in has inconsistencies. During troubleshooting I found that if I created a new directory where I'd never before executed Claude then I didn't get an error. I then cloned a repository to a new directory and tried again and now get this error:

Image

@malginin
Copy link

malginin commented Apr 9, 2025

I had a few unrelated errors trying to use Claude's foundation-model ARNs. I'm not even sure they can be used directly at all. Unless your goal is to make it run wholly within your chosen region, arn:aws:bedrock:us-east-1:XXXXXXXXX:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0 should be used.

@sdcampbell
Copy link

I had a few unrelated errors trying to use Claude's foundation-model ARNs. I'm not even sure they can be used directly at all. Unless your goal is to make it run wholly within your chosen region, arn:aws:bedrock:us-east-1:XXXXXXXXX:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0 should be used.

I tried that and still have the same issue. Thanks

@sdcampbell
Copy link

This command works:

ANTHROPIC_MODEL=us.anthropic.claude-3-7-sonnet-20250219-v1:0 CLAUDE_CODE_USE_BEDROCK=1 claude

This is likely (suspected but not proven) because the Claude CLI is already constructing the full ARN internally when you provide it with the inference profile ID, so passing the complete ARN was causing the "Interrupted by user" error.

@acholonu
Copy link

This command works:

ANTHROPIC_MODEL=us.anthropic.claude-3-7-sonnet-20250219-v1:0 CLAUDE_CODE_USE_BEDROCK=1 claude

This is likely (suspected but not proven) because the Claude CLI is already constructing the full ARN internally when you provide it with the inference profile ID, so passing the complete ARN was causing the "Interrupted by user" error.

This worked for me too.

@q2mark
Copy link

q2mark commented Apr 28, 2025

The above solutions didn't work for me. AWS Bedrock generally works fine via aws command line, litellm, etc. I submit a query and claude code says "percolating" and possibly one other action word, and then goes straight to "Interrupted by user"

I'm not able to submit a bug with /bug, it goes straight to "Interrupted by user"

If there's any way to print anything verbose at all here, let me know how.

mark@WSL-PC:~/test-dir$ claude --debug
╭────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview! │
│                                            │
│   /help for help                           │
│                                            │
│   cwd: /home/mark/test-dir                 │
│                                            │
│   ──────────────────────────────────────── │
│                                            │
│   Overrides (via env):                     │
│                                            │
│   • Model: bedrock/us.anthropic.claude-3-7 │
│   -sonnet-20250219-v1:0                    │
╰────────────────────────────────────────────╯

 Tips for getting started:

 1. Ask Claude to create a new app or clone a repository
 2. Use Claude to help with file analysis, editing, bash commands and git
 3. Be as specific as you would with another engineer for the best results

 ※ Tip: Use git worktrees to run multiple Claude sessions in parallel. Learn more (​https://docs.anthropic.com/s/claude-code-worktrees​)

> hello
  ⎿  Interrupted by user
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                                                                                                       │
│╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│
││ >                                                                                                                                                                   ││
│╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯│
│  ? for shortcuts                                                                                0 tokens (100% cached) globalVersion: 0.2.86 · latestVersion: 0.2.86  │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

@Clabes
Copy link

Clabes commented May 5, 2025

I'm having the same issue. I tried pretty much every variation of using the model ARN and the cross-region reference ID that AWS gives to access the model. For info, I'm using temp AWS_ACCESS_KEY. Also, setting
ANTHROPIC_MODEL=us.anthropic.claude-3-7-sonnet-20250219-v1:0
doesn't reset that variable if it was previously defined using claude config set --global env '{"CLAUDE_CODE_USE_BEDROCK": "true", "ANTHROPIC_MODEL": "us.anthropic.claude-3-7-sonnet-20250219-v1:0"}'

@Clabes
Copy link

Clabes commented May 5, 2025

I just tested the command with Haiku Claude 3.0 with the prompt below and I get functionality, but with Claude 3.7 does not:

claude config set --global env '{"CLAUDE_CODE_USE_BEDROCK": "true", "ANTHROPIC_MODEL": "us.anthropic.claude-3-haiku-20240307-v1:0", "DISABLE_PROMPT_CACHING": "true"}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants