Claude Code has hardcoded /home/node/.config path causing warnings on non-containerized systems
Claude Code has hardcoded /home/node/.config path causing warnings on non-containerized systems
Issue Summary
Claude Code displays hardcoded path warning "Path /home/node/.config was not found" when running in WSL2, indicating the binary contains hardcoded references to /home/node/.config instead of
using standard path resolution.
Environment Details
- Host OS: Windows 11 (inferred from WSL2 kernel version 6.6.87.2-microsoft-standard-WSL2)
- WSL2 Distro: Ubuntu-24.04 (Ubuntu 24.04.3 LTS, Codename: noble)
- WSL2 Kernel: Linux 6.6.87.2-microsoft-standard-WSL2
- Docker Desktop: Version 28.3.2 (build 578ccf6)
- VS Code: With Dev Containers extension
- Node.js: v22.17.1 (via nvm)
- npm: v10.9.2
- Claude Code Version: 1.0.84
- Claude Code Installation:
/home/<USER>/.nvm/versions/node/v22.17.1/lib/node_modules/@anthropic-ai/claude-code/
Issue Timeline
Critical Detail: This warning began appearing specifically AFTER implementing the VS Code Dev Containers extension following Anthropic's official devcontainer documentation at
https://docs.anthropic.com/en/docs/claude-code/devcontainer
The devcontainer setup includes:
- Base image:
node:20(official Node.js Docker image as per Anthropic's documentation) - Container user:
node(standard in Node.js images) - Container paths:
/home/node/.claude,/home/node/.config/*
The issue occurs when running Claude Code in the host WSL2 environment AFTER setting up the devcontainer, suggesting potential configuration bleed-through or environment assumption
contamination.
Path Analysis
- Expected by Claude Code:
/home/node/.config(hardcoded) - Actual WSL2 user:
<USER>(notnode) - Actual config path:
/home/<USER>/.config - Claude config directory:
/home/<USER>/.claude(correctly resolved via CLAUDE_CONFIG_DIR environment variable) - Devcontainer mount: Maps
${localEnv:HOME}/.configto/home/node/.config(see configuration files below)
Evidence of Hardcoded Path
- Binary inspection: Claude Code executable is heavily minified JavaScript, suggesting build-time path resolution
- Environment variables:
CLAUDE_CONFIG_DIR=/home/<USER>/.claudeworks correctly, but/home/node/.configwarning persists - Path specificity: Warning specifically mentions
/home/node/.config, not a relative or environment-based path - Container context: Path matches exactly with Node.js Docker container conventions used in Anthropic's official devcontainer setup
- Timing correlation: Issue appeared only after following Anthropic's devcontainer documentation
- Configuration evidence: The devcontainer configuration explicitly creates and maps to
/home/node/.configpaths (see appendix)
Root Cause
Claude Code appears to have been developed/tested primarily in Node.js containerized environments where /home/node is the standard user home directory (as evidenced by Anthropic's own
devcontainer documentation). The path /home/node/.config was likely baked into the binary during the build process instead of using proper runtime path resolution (process.env.HOME,os.homedir(), or $HOME/.config).
Impact
- Cosmetic warning that appears on every Claude Code startup in non-containerized environments
- No functional impact - Claude Code operates normally
- Poor user experience for developers following Anthropic's own devcontainer setup guide
- Creates confusion about whether the setup was implemented correctly
Expected Behavior
Claude Code should use standard path resolution methods and respect the current user's home directory, not hardcode specific usernames, regardless of whether the user has implemented devcontainer
setup.
Steps to Reproduce
- Install Claude Code via npm in WSL2 environment:
npm install -g @anthropic-ai/claude-code - Run
claudefrom command line and verify it works without warnings - Follow Anthropic's devcontainer setup guide at https://docs.anthropic.com/en/docs/claude-code/devcontainer
- Implement VS Code Dev Containers extension with Node.js 20 base image
- Run
claudefrom WSL2 command line again (not in container) - Observe new warning: "Path /home/node/.config was not found."
- Note that
/home/nodedirectory does not exist in WSL2 host environment
Related Documentation
---
Appendix A: devcontainer.json Configuration
The devcontainer configuration showing explicit /home/node path mappings:
Basic Configuration
- Name: "Claude Code Sandbox"
- Base Image: Node.js 20 via Dockerfile
- Remote User:
node - Workspace:
/workspace
Volume Mounts
The following mounts demonstrate the expected /home/node paths:
"mounts": [
"source=claude-code-bashhistory-${devcontainerId},target=/commandhistory,type=volume",
"source=${localEnv:HOME}/.claude,target=/home/node/.claude,type=bind,consistency=cached",
"source=${localEnv:HOME}/.claude-flow,target=/home/node/.claude-flow,type=bind,consistency=cached",
"source=${localEnv:HOME}/.gitconfig,target=/home/node/.gitconfig,type=bind,consistency=cached",
"source=${localEnv:HOME}/.ssh,target=/home/node/.ssh,type=bind,consistency=cached,readonly",
"source=${localEnv:HOME}/.config,target=/home/node/.config,type=bind,consistency=cached",
"source=${localEnv:HOME}/.git-credentials,target=/home/node/.git-credentials,type=bind,consistency=cached"
]
Container Environment Variables
"containerEnv": {
"NODE_OPTIONS": "--max-old-space-size=4096",
"CLAUDE_CONFIG_DIR": "/home/node/.claude",
"POWERLEVEL9K_DISABLE_GITSTATUS": "true",
"GIT_CONFIG_GLOBAL": "/home/node/.gitconfig",
"GH_CONFIG_DIR": "/home/node/.config/gh"
}
Appendix B: Dockerfile Configuration
The Dockerfile showing explicit creation of /home/node/.config directories:
Base Image and User Setup
- Base Image: FROM node:20
- Username: node (ARG USERNAME=node)
- User Switch: USER node (line 59)
Directory Creation (Lines 44-48)
RUN mkdir -p /workspace /home/node/.claude /home/node/.config/gh /home/node/.ssh \
/home/node/.config/git /home/node/.local/share/pnpm /home/node/.npm && \
chown -R node:node /workspace /home/node/.claude /home/node/.config \
/home/node/.ssh /home/node/.local /home/node/.npm && \
chmod -R 755 /home/node/.claude /home/node/.config/gh /home/node/.ssh
Claude Code Installation (Lines 82-86)
RUN npm install -g @anthropic-ai/claude-code@${CLAUDE_CODE_VERSION} && \
npm install -g pnpm && \
npm install -g claude-flow@alpha && \
npm cache clean --force
Key Evidence
- Line 44: Explicitly creates /home/node/.config/gh and /home/node/.config/git
- Lines 46: Sets ownership of /home/node/.config to the node user
- Line 83: Installs Claude Code in the same environment where /home/node/.config is expected to exist
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗