[BUG] settings.json loaded twice when running Claude Code from home directory, causing duplicate permissions
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?
When running Claude Code from the home directory (~), the settings.json file is loaded twice - once as the user-scope settings (~/.claude/settings.json) and once as the project-scope settings (./.claude/settings.json), which resolves to the same file.
This causes permissions to be duplicated, as the same permission entries are read from both scopes and accumulated.
What Should Happen?
Claude Code should detect when user-scope and project-scope settings files resolve to the same path and only load the file once. Alternatively, it should deduplicate permissions after merging settings from multiple scopes.
Error Messages/Logs
No error message is displayed. The issue is observable by examining the loaded permissions - duplicate entries appear for the same permission rules.
Steps to Reproduce
- Ensure you have ~/.claude/settings.json with some permissions configured:
``json``
{
"permissions": {
"allow": [
"Bash(git:*)"
]
}
}
- Navigate to your home directory:
$ cd ~
- Run Claude Code:
$ claude
- Observe that permissions are loaded twice because:
- User-scope: ~/.claude/settings.json is loaded
- Project-scope: ./.claude/settings.json (which is ~/.claude/settings.json) is also loaded
- The same permission entries are duplicated in the effective configuration.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.17
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
Related Issues
- #6874 - Duplicate permissions accumulate in settings.local.json (CLOSED)
- #7300 - Claude Code writes settings to both home directory and project directories
Root Cause Analysis
The settings loading mechanism reads from multiple scopes (user → project → local) without checking if the resolved file paths are identical. When the current working directory is ~, both user-scope (~/.claude/settings.json) and project-scope (./.claude/settings.json) point to the same file.
Suggested Fix
Before loading settings from each scope, normalize the file path and skip loading if it has already been loaded from a previous scope.
Workaround
Run Claude Code from a project directory rather than the home directory, or use --setting-sources user to explicitly load only user-scope settings.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗