claude-code - 💡(How to fix) Fix Haiku asks clarifying questions in -p (print) mode instead of executing [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48515Fetched 2026-04-16 06:58:02
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×5commented ×1

When using claude -p (print/non-interactive mode) with --dangerously-skip-permissions and --model claude-haiku-4-5, the model sometimes asks a clarifying question instead of executing the task, producing zero output files.

Root Cause

When using claude -p (print/non-interactive mode) with --dangerously-skip-permissions and --model claude-haiku-4-5, the model sometimes asks a clarifying question instead of executing the task, producing zero output files.

Code Example

mkdir /tmp/cc-test && cd /tmp/cc-test
cat > TASK.md << 'EOF'
# Task: Build a Python CLI Todo App
Build a complete CLI todo application with argparse, persistence, tests (12+), type hints.
EOF

claude -p "Read TASK.md and implement everything it asks for. Write all files and run the tests." \
  --model claude-haiku-4-5 \
  --max-turns 15 \
  --dangerously-skip-permissions \
  --output-format text
RAW_BUFFERClick to expand / collapse

Description

When using claude -p (print/non-interactive mode) with --dangerously-skip-permissions and --model claude-haiku-4-5, the model sometimes asks a clarifying question instead of executing the task, producing zero output files.

Reproduction

mkdir /tmp/cc-test && cd /tmp/cc-test
cat > TASK.md << 'EOF'
# Task: Build a Python CLI Todo App
Build a complete CLI todo application with argparse, persistence, tests (12+), type hints.
EOF

claude -p "Read TASK.md and implement everything it asks for. Write all files and run the tests." \
  --model claude-haiku-4-5 \
  --max-turns 15 \
  --dangerously-skip-permissions \
  --output-format text

Expected behavior

In -p mode, the model should execute the task and produce output files, not ask clarifying questions. The docs describe -p as "Print response without interactive mode" — there's no stdin to receive answers, so asking questions is a dead end.

Actual behavior (intermittent)

On ~1 in 3 runs, Haiku outputs a design proposal and asks "Does this approach look right? Should I proceed?" instead of writing code. No files are created. The same prompt on the same model via a different harness (D.U.H.) executes successfully 3/3 times, suggesting the system prompt could be more directive in print mode.

Environment

  • Claude Code version: 2.1.109
  • Model: claude-haiku-4-5
  • OS: macOS (Apple Silicon)
  • Flags: -p --dangerously-skip-permissions --max-turns 15

Notes

This may be a system prompt issue rather than a CLI bug — the model needs stronger instruction to execute rather than deliberate when running in non-interactive mode. Alternatively, -p mode could append something like "Do not ask clarifying questions — execute the task directly" to the system prompt.

extent analysis

TL;DR

Modify the system prompt to include a directive that prevents the model from asking clarifying questions in non-interactive mode.

Guidance

  • Review the system prompt used in the D.U.H. harness to understand how it differs from the current prompt and how it achieves successful execution.
  • Consider appending a directive to the system prompt in -p mode, such as "Do not ask clarifying questions — execute the task directly", to instruct the model to execute the task without deliberation.
  • Test the modified system prompt with the provided reproduction steps to verify its effectiveness.
  • If the issue persists, investigate the model's behavior and the specific conditions under which it asks clarifying questions to identify potential improvements to the prompt or model configuration.

Example

No code snippet is provided as the issue is related to the system prompt and model configuration rather than a specific code implementation.

Notes

The root cause of the issue is likely related to the system prompt and model configuration, rather than a bug in the CLI. The fact that the same prompt works successfully in a different harness suggests that the issue can be addressed through modifications to the system prompt or model configuration.

Recommendation

Apply a workaround by modifying the system prompt to include a directive that prevents the model from asking clarifying questions in non-interactive mode, as this approach has shown promise in the D.U.H. harness and can be tested and refined without requiring significant changes to the CLI or model.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

In -p mode, the model should execute the task and produce output files, not ask clarifying questions. The docs describe -p as "Print response without interactive mode" — there's no stdin to receive answers, so asking questions is a dead end.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING