[BUG] --dangerously-skip-permissions (and bypassPermissions mode) does not suppress Write/Edit approval prompt in --print mode
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?
Claude Code version: 2.1.291 (also reproduced on 2.1.288)
Description:
In non-interactive --print mode, none of the following actually bypass the file-write permission prompt: --dangerously-skip-permissions, --dangerously-skip-permissions combined with --allow-dangerously-skip-permissions, or --permission-mode bypassPermissions. The CLI still responds as if the Write/Edit tool call needs approval, and since there's no one to approve it in a non-interactive context, the tool call is effectively denied and the session reports it can't write the file.
This breaks any headless/cron-style automation that relies on claude --print --dangerously-skip-permissions to edit files unattended.
Steps to reproduce:
mkdir -p /tmp/claude_perm_test && cd /tmp/claude_perm_test
echo hello > test.txt
claude --print --dangerously-skip-permissions "Append WORLD to test.txt"
cat test.txt
Expected: test.txt is edited to include "WORLD", no prompt.
Actual:
I don't have permission to write test.txt — please grant write access and I'll append "WORLD" to it.
test.txt is left unchanged (hello).
Additional notes:
Reproduced in a clean shell with no CLAUDE_CODE_CHILD_SESSION/CLAUDECODE env vars set, ruling out nested-session contamination.
Also tried --permission-mode bypassPermissions alone and combined with --permission-prompts none — same failure (with --permission-prompts none, the CLI explicitly says it has "no approval surface" and auto-denies, rather than bypassing).
This surfaced while debugging a failing macOS launchd cron job that calls claude --print --dangerously-skip-permissions "<prompt>" to edit a file unattended — the job runs but silently fails to write anything every time.
What Should Happen?
Expected: test.txt is edited to include "WORLD", no prompt.
Error Messages/Logs
get a result: I don't have permission to write test.txt — please grant write access and I'll append "WORLD" to it.
Steps to Reproduce
mkdir -p /tmp/claude_perm_test && cd /tmp/claude_perm_test
echo hello > test.txt
claude --print --dangerously-skip-permissions "Append WORLD to test.txt"
cat test.txt
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Not sure
Claude Code Version
Claude Code version: 2.1.291 (also reproduced on 2.1.288)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_