Bug: Claude CLI non-interactive mode doesn't respect configured tool permissions

Resolved 💬 13 comments Opened Mar 21, 2025 by swellmkt Closed Jun 20, 2025

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

  1. Configure Claude CLI with Bash tool permissions (already done, see config below)
  2. Run this command:

``
claude -p "npm run build and git commit and git push"
``

  1. 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.

View original on GitHub ↗

This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗