claude-code - 💡(How to fix) Fix [BUG] parallel Bash calls get cancelled when grep returns exit code 1 [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#55515Fetched 2026-05-03 04:51:22
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

grep 没匹配到内容时返回 exit code 1,框架把这个非零退出码当成了执行失败,连带把并行组里的另一个命令也干掉了。但 grep 返回 1 只是表示「没找到」,不是真报错。

What Should Happen?

parallel Bash calls get cancelled when grep returns exit code 1

Error Messages/Logs

Steps to Reproduce

parallel Bash calls get cancelled when grep returns exit code 1

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.126

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

extent analysis

TL;DR

The issue can be fixed by modifying the grep command to return a zero exit code when no matches are found, or by adjusting the framework to handle grep's exit code 1 as a non-error condition.

Guidance

  • Verify that the grep command is being used with the correct options to return a zero exit code when no matches are found, such as using grep -q instead of just grep.
  • Check the framework's documentation to see if there is a way to configure it to ignore grep's exit code 1 as a non-error condition.
  • Consider using a wrapper script around the grep command to handle the exit code and return a zero exit code when no matches are found.
  • Review the changes made in the latest version of Claude Code to see if there is a specific commit or change that introduced this behavior.

Example

# Instead of using grep directly
grep "pattern" file.txt

# Use grep -q to return a zero exit code when no matches are found
if grep -q "pattern" file.txt; then
  # Handle match found
else
  # Handle no match found
fi

Notes

The issue seems to be specific to the interaction between the grep command and the framework, and the solution may depend on the specific requirements of the project. Further investigation into the framework's documentation and the changes made in the latest version of Claude Code may be necessary to find a complete solution.

Recommendation

Apply workaround: Modify the grep command to return a zero exit code when no matches are found, as this is a more straightforward solution that can be implemented immediately.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] parallel Bash calls get cancelled when grep returns exit code 1 [1 comments, 2 participants]