[BUG] Bedrock env vars ignored in home directory

Resolved 💬 4 comments Opened Jun 4, 2025 by clayallsopp Closed Aug 8, 2025

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [x] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: <!-- output of claude --version -->
  • Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 -->
  • Terminal: <!-- e.g. iTerm2, Terminal App -->

Bug Description

When running claude in the home directory with the ANTHROPIC_* and CLAUDE_CODE_USE_BEDROCK variables set, it seems like Bedrock is still used for queries, but it is no longer respecting the ANTHROPIC_MODEL parameters:

╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
│                                                   │
│   /help for help, /status for your current setup  │
│                                                   │
│   cwd: /Users/callsopp                            │
╰───────────────────────────────────────────────────╯


> Hello
  ⎿ API Error: 403 {"Message":"User: xxx/callsopp is not authorized
    to perform: bedrock:InvokeModel on resource:
    arn:xxx:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0 because no session
    policy allows the bedrock:InvokeModel action"}

That inference profile is the default Bedrock inference profile, which my AWS permissions do not have access to. My ANTHROPIC_MODEL is set to the proper inference profile, but it isn't being used. This only seems to happen when my cwd is my home directory (which isn't advised but some teammates have reasons for doing this, such as on VMs).

Steps to Reproduce

  1. Set Bedrock env vars
  2. Try to run a query
  3. Observe the wrong ANTHROPIC_MODEL is used (should be possible to repro by setting a fake ANTHROPIC_MODEL and then still seeing the default profile used)

Expected Behavior

The ANTHROPIC_MODEL should be used

Actual Behavior

The default Bedrock model/inference profile is used

Additional Context

<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗