[BUG]: CLI error with system prompt and doesn't recognize permissions

Status Closed — not planned
Maintainer reply None cached
Activity 12 comments · opened Aug 1, 2025 · closed Apr 1, 2026
time claude --mcp-config "" --strict-mcp-config --model opus --debug --system-prompt "Do you have permission to use the bash tool?" -p

Error: Input must be provided either through stdin or as a prompt argument when using --print

---

I did provide the --system-prompt field, which works in other cases. I get the same error with --append-system-prompt.

Incidentally, the --system-prompt argument appears to work, but does not show up in the --help documentation.

---

Another bug: Claude does not recognize permissions. Look at this:

claude --mcp-config "" --strict-mcp-config --model opus --debug -p "Do you have permission to use the bash tool?"

Yes, I have permission to use the bash tool.

time claude --mcp-config "" --strict-mcp-config --model opus -p --system-prompt "Here is a large PDF. Use qpdf to extract the first page of this PDF. Then, read and summarize the first page." "mypdf.pdf"

The PDF file is too large (143.4MB) to read directly with the Read tool. I need to use qpdf to extract just the first page, which will make it small enough to read. Could you please grant permission for me to use the Bash tool so I can run the qpdf command to extract the first page?

View original on GitHub ↗

12 Comments

github-actions[bot] · 1 year ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4787
  2. https://github.com/anthropics/claude-code/issues/2546
  3. https://github.com/anthropics/claude-code/issues/932

If your issue is a duplicate, please close it and 👍 the existing issue instead.

🤖 Generated with Claude Code

nsheff · 1 year ago

For the issue related to bash permissions, I found the solution: It really needed Bash(qpdf:*). While it had other Bash permissions set, it didn't have that specifically.
So, the error messages just needs to be more specific. As is, it was confusing. It didn't need Bash permission (which it had, said generally like that) -- it needed something more specific. A more specific error message would have prevented me from searching down the wrong path for awhile.

github-actions[bot] · 9 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

rnorth · 9 months ago

This is still occurring.

As per https://github.com/anthropics/claude-code/issues/6820 it can also be seen when using op run ... -- claude (to inject secrets from 1Password). It looks like op run passes through stdin/stdout normally so I'm not sure why this is happening.

Curiously:

op run --env-file="$HOME/.config/claude/secrets.env" -- /opt/homebrew/bin/claude # FAILS
op run -- /opt/homebrew/bin/claude # WORKS

So I'd imagine there's a clue in exactly what/how op behaves in each of these cases.

Either way, claude is apparently behaving incorrectly for a *nix program, and it'd be extremely helpful if this could be resolved.

marimeireles · 8 months ago

can reproduce on osx with micromamba(conda equivalent env.)
fixed by reactivating the env.

bdruth · 8 months ago
This is still occurring. As per #6820 it can also be seen when using op run ... -- claude (to inject secrets from 1Password). It looks like op run passes through stdin/stdout normally so I'm not sure why this is happening. Curiously: `` op run --env-file="$HOME/.config/claude/secrets.env" -- /opt/homebrew/bin/claude # FAILS op run -- /opt/homebrew/bin/claude # WORKS ` So I'd imagine there's a clue in exactly what/how op behaves in each of these cases. Either way, claude` is apparently behaving incorrectly for a *nix program, and it'd be extremely helpful if this could be resolved.

Both with and without the env-file exhibit the same behavior for me, fwiw. Both fail.

bdruth · 8 months ago

Here's a quick workaround for now:

op run --env-file "$CLAUDE_CREDS_FILE" -- script -q /dev/null claude

Per Gemini:

It sounds like claude-code is checking if it’s connected to a real TTY (teletypewriter). When you wrap a command in op run or similar environment injectors, the tool sometimes fails to detect an interactive terminal session and defaults to its "non-interactive" mode (which requires --print). Since the tool doesn't have a --force-interactive flag yet, you can use a "pseudo-terminal" wrapper to trick the process into thinking it’s talking directly to a user. 1. The script Command (Most Portable) The script command is designed to record terminal sessions, but a side effect is that it creates a pseudo-terminal (pty) for the command it runs. This is often the most reliable way to "fake" a TTY.
mieubrisse · 7 months ago

Confirming this is still an issue with Claude 2.1.6 via:

op run --env-file ".claude/secrets.env" -- claude

@bdruth 's fix does indeed work though (thank you!)

querl369 · 6 months ago

@bdruth thanks for the workaround, the main issue persists

cellulosa · 5 months ago

I got it working by using the --no-masking flag with the op command.

Note I am using the new environments feature with the service accounts, as I am sharing secrets with my team. I launch a new shell and run:

export OP_SERVICE_ACCOUNT_TOKEN=<service-account-token>
op run --environment <environment-id> --no-masking -- claude
github-actions[bot] · 5 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.