[BUG] Bash tool environment has RUSTUP_TOOLCHAIN=1.80.1 set from unknown source
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The Bash tool environment contains RUSTUP_TOOLCHAIN=1.80.1, which overrides the user's default Rust toolchain. This causes rustc and cargo to use Rust 1.80.1 instead of the user's configured stable (1.93.0). The variable is not set in any user-controlled configuration — it appears to be injected by the Claude Code runtime.
This is particularly disruptive for Rust projects using edition = "2024" (requires Rust 1.85+), which fail to compile entirely under the Bash tool.
What Should Happen?
The Bash tool should inherit the user's Rust toolchain configuration. RUSTUP_TOOLCHAIN should not be set unless the user explicitly configures it.
Error Messages/Logs
# Inside Claude Code Bash tool:
$ echo $RUSTUP_TOOLCHAIN
1.80.1
$ rustc --version
rustc 1.80.1 (3f5fd8dd4 2024-08-06)
$ rustup show
installed toolchains
--------------------
stable-aarch64-apple-darwin (default)
nightly-aarch64-apple-darwin
1.80.1-aarch64-apple-darwin (active)
active toolchain
----------------
name: 1.80.1-aarch64-apple-darwin
active because: overridden by environment variable RUSTUP_TOOLCHAIN
# In user's normal shell (outside Claude Code):
$ rustc --version
rustc 1.93.0 (254b59607 2026-01-19)
# Workaround inside Claude Code:
$ RUSTUP_TOOLCHAIN=stable rustc --version
rustc 1.93.0 (254b59607 2026-01-19)
Steps to Reproduce
- Have Rust installed via rustup with
stableas the default toolchain - Open Claude Code
- Ask Claude to run
echo $RUSTUP_TOOLCHAIN— observe it is set to1.80.1 - Ask Claude to run
rustc --version— observe it reports 1.80.1 instead of the user's default
Verified: not set by user configuration
# No rust-toolchain file in project:
$ ls rust-toolchain rust-toolchain.toml
ls: No such file or directory (both)
# No rustup directory override:
$ rustup override list
no overrides
# No .env files in project or home:
$ ls ~/.env ./.env ~/projects/.env
# All: No such file or directory
# Not in any shell profile:
$ grep -rn "RUSTUP_TOOLCHAIN" ~/.zshrc ~/.zprofile ~/.profile ~/.zshenv
# No matches
# Not in Claude Code settings:
$ grep "RUSTUP_TOOLCHAIN" ~/.claude/settings.json
# No matches
Additionally, uninstalling the rust-analyzer-lsp plugin and restarting did not resolve the issue.
Is this a regression?
I don't know
Claude Code Version
2.1.63 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other (Ghostty)
Additional Information
- macOS 26.3 (Build 25D125), Apple Silicon (aarch64-apple-darwin)
- Shell: zsh 5.9 (Homebrew)
- Workaround: prefix all cargo/rustc commands with
RUSTUP_TOOLCHAIN=stable - Related: #401 and #3403 describe Claude Code unexpectedly loading
.envfiles into the Bash environment. This may be a similar mechanism injecting toolchain-related env vars.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗