Bug: Claude CLI non-interactive mode doesn't respect configured tool permissions
Bug: Claude CLI non-interactive mode doesn't respect configured tool permissions
Description
When using Claude CLI in non-interactive mode with the -p flag to run bash commands, Claude requests permission to use the Bash tool even though permissions are already configured. The same commands run without any permission issues in interactive mode.
Steps to Reproduce
- Configure Claude CLI with Bash tool permissions (already done, see config below)
- Run this command:
````
claude -p "npm run build and git commit and git push"
- Observe the error message: "I need permission to use the Bash tool to run these commands. Once granted, I'll build the project and commit the changes."
Expected Behavior
Claude should recognize the pre-configured Bash tool permissions and execute the commands without requesting additional permissions, just as it does in interactive mode.
Actual Behavior
Claude asks for permission to use the Bash tool despite the tool being listed in the allowed tools configuration.
Configuration
{
"allowedTools": [
"Bash",
"Create",
"Edit",
"Read",
"Write"
],
"dontCrawlDirectory": false,
"hasTrustDialogAccepted": "true",
"hasCompletedProjectOnboarding": "true",
"ignorePatterns": []
}
Additional Information
- The exact same command sequence works perfectly when used in interactive mode
- Command used:
claude -p "npm run build and git commit and git push" - Claude CLI version: [Include your version here]
- Operating System: [Include your OS here]
- This issue started occurring after a recent update (within the last few updates)
- The functionality used to work correctly in previous versions
Impact
This issue prevents using Claude CLI effectively in scripts or automated workflows where interactive mode isn't feasible.
This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗