[DOCS] `CLAUDE_CODE_TMPDIR` docs overstate long-path `$TMPDIR` fallback for Bash commands
Documentation Type
Incorrect/outdated documentation
Documentation Location
https://code.claude.com/docs/en/env-vars
Section/Topic
CLAUDE_CODE_TMPDIR environment variable reference
Current Documentation
The CLAUDE_CODE_TMPDIR row currently says:
Override the temp directory used for internal temp files. Claude Code appends/claude-{uid}/on Unix or/claude/on Windows to this path. Default:/tmpon macOS,os.tmpdir()on Linux and Windows. As of v2.1.161, on macOS and Linux, Bash subprocesses receive a short fallback$TMPDIRunder the system default when your override is a long path, since some tools fail when temp paths get too long. Claude Code's own temp files always use your override
The v2.1.163 release notes say:
Fixed bash commands failing under bazel and EDR-protected Go workflows:$TMPDIRwas overridden to/tmp/claude-{uid}for all commands instead of only sandboxed ones (regression in 2.1.154)
What's Wrong or Missing?
A. The CLAUDE_CODE_TMPDIR docs still describe the long-path fallback as applying to Bash subprocesses generally
The current wording says Bash subprocesses receive the short fallback $TMPDIR when the override path is long, without distinguishing sandboxed from unsandboxed commands.
B. v2.1.163 narrows that behavior
The v2.1.163 release note says forcing /tmp/claude-{uid} for all Bash commands was a regression and that the override should only apply to sandboxed commands. That means the env-var reference now overstates the fallback behavior and can mislead users debugging Bazel runs, EDR-sensitive tools, and Go workflows that depend on the host temp directory for unsandboxed commands.
Suggested Improvement
Update the CLAUDE_CODE_TMPDIR row to distinguish Claude Code's own temp files from Bash command temp-directory behavior, and clarify the post-v2.1.163 scope.
Minimum fix:
Claude Code always uses this override for its own internal temp files. On macOS and Linux, when sandboxed Bash commands need a shorter temp path, Claude Code may provide a short fallback $TMPDIR under the system default. Unsandboxed commands should continue to use the normal host temp-directory behavior rather than inheriting the sandbox-specific fallback.
If the exact rule is more nuanced than that, the docs should still explicitly state which command classes get the fallback (sandboxed, excludedCommands, dangerouslyDisableSandbox, hooks, MCP stdio servers) so users can predict behavior in Bazel and EDR-constrained environments.
Impact
High - Prevents users from using a feature
Additional Context
Affected Pages:
| Page | Line(s) | Context |
|------|---------|---------|
| https://code.claude.com/docs/en/env-vars | 256 | CLAUDE_CODE_TMPDIR says the short fallback $TMPDIR applies to Bash subprocesses generally |
| https://github.com/anthropics/claude-code/releases/tag/v2.1.163 | Release notes | v2.1.163 says /tmp/claude-{uid} was incorrectly forced for all Bash commands instead of only sandboxed ones |
Total scope: 2 pages affected
This looks like a docs regression caused by the v2.1.161 wording remaining broader than the v2.1.163 behavior. The release note specifically mentions Bazel and EDR-protected Go workflows failing when /tmp/claude-{uid} was forced too broadly, so clarifying the scope on env-vars would help users understand why unsandboxed commands should no longer inherit that sandbox-specific temp path.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗