#22502: fix(errors): distinguish process termination from billing errors
agents
size: XS
Cluster:
Error Handling Improvements
Fixes #11722
When local `exec` commands are terminated by SIGPIPE (exit code 141) or SIGKILL (exit code 137), they were incorrectly reported as "API billing errors".
## Changes
- Added `isProcessTerminationError()` function to detect SIGPIPE/SIGKILL signals
- Modified `isBillingErrorMessage()` to exclude process termination errors
- Users now see appropriate error messages instead of misleading billing warnings
## Testing
1. Run a command that triggers SIGPIPE: `curl -I https://example.com 2>&1 | head -n 5`
2. Verify the error message mentions process termination, not billing
---
Feedback welcome!
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added `isProcessTerminationError()` function to detect SIGPIPE (exit code 141/signal 13) and SIGKILL (exit code 137/signal 9) errors, and modified `isBillingErrorMessage()` to exclude these process termination errors, preventing them from being incorrectly reported as API billing errors.
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with low risk
- The implementation correctly identifies process termination signals and prevents false positives in billing error detection. The logic is sound, covers all relevant signal codes (both numeric and name-based), and the change is narrowly scoped to fix a specific issue.
- Consider adding unit tests for `isProcessTerminationError()` to verify all signal detection patterns work correctly
<sub>Last reviewed commit: 7e90325</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#9173: Fix: Improve error messaging for API rate limits and billing errors
by vishaltandale00 · 2026-02-04
71.4%
#12273: fix: prevent billing error false positive on bare '402' in chat con...
by Yida-Dev · 2026-02-09
71.2%
#15109: fix: distinguish transient API errors from billing errors
by jwchmodx · 2026-02-13
71.0%
#16307: fix: surface billing/auth FailoverErrors as user-friendly messages
by petter-b · 2026-02-14
69.5%
#16962: fix: make auth error detection contextual to prevent false positives
by StressTestor · 2026-02-15
66.9%
#19271: fix: remove false-positive billing text rewrite in sanitizeUserFaci...
by MisterGuy420 · 2026-02-17
66.7%
#2744: FIX(imessage): preserve signal info in RPC close handler
by sal-jim · 2026-01-27
66.1%
#23520: fix: trigger failover on Anthropic insufficient_quota (HTTP 400) (#...
by dissaozw · 2026-02-22
65.5%
#17950: fix: filter error payloads from user-facing messages
by Suksham-sharma · 2026-02-16
65.2%
#20262: fix: detect Venice 402 insufficient USD/Diem balance as billing fai...
by ZPTDclaw · 2026-02-18
64.5%