Bash tool returns exit code 1 with no stdout/stderr on CachyOS (Arch Linux)
Status Closed — not planned
Reported on v2.1.87
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 9 comments · opened Mar 30, 2026 · closed May 15, 2026
Description
The Bash tool in Claude Code always returns exit code 1 with no stdout or stderr output for every command, including simple builtins like echo "test", true, whoami, etc.
Commands do execute successfully — this was proven by redirecting output to a file (command > file.txt 2>&1; exit 0) and reading it with the Read tool. The issue is purely with output capture / return.
Environment
- Claude Code version: 2.1.87
- OS: CachyOS (Arch Linux based, kernel 6.19.9-2-cachyos)
- Shell: bash (used by Bash tool), fish (user default), zsh (also installed)
- Architecture: x86_64 (znver4)
Steps to reproduce
- Install Claude Code on CachyOS
- Run any Bash tool command, e.g.
echo "hello" - Result: exit code 1, no output
What was tried (none of these fixed it)
- Setting
sandbox.enabled: falsein settings.json - Adding
Bash(*)to permissions allow list - Setting
"SHELL": "/bin/bash"in env config - Adding non-interactive guard to .zshrc (
[[ $- != *i* ]] && return) - Using
dangerouslyDisableSandbox: trueparameter - Restarting Claude Code multiple times
Workaround
Redirecting output to a file works reliably:
{ command; } > /home/user/output.txt 2>&1; exit 0
Then using the Read tool to read the file.
Additional context
- The user's zsh config includes Powerlevel10k, oh-my-zsh, and CachyOS-specific zsh plugins — these may interfere with non-interactive output capture
- The Bash tool confirmed it runs under
bash(viaps -p $$ -o comm=redirected to file) exit 0is the only "command" that returns exit code 0 normally- The user reports this worked fine on Bazzite (Fedora-based) previously
9 Comments
This is almost certainly caused by zsh/Powerlevel10k initialization interfering with the Bash tool's output capture, even though the tool runs under
bash.Root cause
Claude Code's Bash tool sources your shell profile on startup. If your
~/.bashrcor/etc/profilesources zsh-specific code (common on Arch/CachyOS), or if environment variables set by Powerlevel10k/oh-my-zsh alter terminal behavior (e.g.,TERM,PROMPT_COMMAND, traps), the output pipe can break silently.Fix to try
~/.bashrc:/etc/bash.bashrcand/etc/profile.d/*.sh— CachyOS may have Arch-specific scripts that set traps or modify file descriptors:Then in your Claude Code settings:
The key insight is that CachyOS bundles aggressive shell customizations by default — the fix is isolating Claude Code's bash subprocess from those customizations.
Thanks for the suggestion @yurukusa! I tried all three approaches:
~/.bashrcguard — already had[[ $- != *i* ]] && returnin both~/.bashrcand/etc/bash.bashrc/etc/profile.d/— found80-systemd-osc-context.sh(systemd OSC 3008 context signalling) which injects escape sequences viaPROMPT_COMMANDandPS0. SetTERM=dumbin Claude Code env settings to make it skip itself.BASH_ENVprofile — setBASH_ENVand clearedENVin settings.Verified all env vars are correctly applied inside the Bash tool subprocess (
TERM=dumb,BASH_ENVset,ENVempty). The systemd OSC script is being skipped. Still broken — every command returns exit code 1 with no stdout/stderr captured.Key finding: commands do execute (proven by redirecting to file and reading it back), but the output pipe back to Claude Code is broken. Even
echo "hello"returns exit 1 with empty output.This appears to be a bug in Claude Code's output capture mechanism itself, not in shell initialization. The file-redirect workaround (
cmd > file 2>&1; exit 0then Read tool) continues to work reliably.System: CachyOS (Arch), kernel 6.19.9-2-cachyos, zsh default shell, Claude Code latest.
Thanks for the thorough testing! Since shell initialization is ruled out and commands execute correctly (just output capture is broken), this is definitely a Claude Code platform bug, not a config issue.
The fact that output piping fails but file redirection works suggests the issue is in how Claude Code's Bash tool sets up the stdout/stderr pipe on CachyOS. A couple more data points that might help the team narrow it down:
child_process— CachyOS ships with a znver4-optimized toolchain that may affect how bun spawns subprocesses. Try:bun -e "const r = require('child_process').execSync('echo hello'); console.log(r.toString())"to see if bun's pipe works at all.dmesg | grep -i seccompafter a failed Bash tool call.Your file-redirect workaround is solid for now. This looks like it needs a fix in Claude Code's process spawning layer for CachyOS/Arch specifically.
Thanks for the follow-up suggestions @yurukusa!
Bun check: Claude Code bundles its own Bun runtime (confirmed: the
claudebinary is an ELF executable containingBUN_1.2). Installed system Bun (1.3.11) separately and tested:Result: works perfectly —
hello, exit 0. So Bun'schild_processpipe handling is fine on this system. The bug is specific to Claude Code's Bash tool implementation, not Bun on CachyOS/Arch in general. Possibly related to the older bundled Bun 1.2 vs current 1.3, or to how Claude Code wraps the subprocess.Seccomp check: No seccomp denials in
dmesg. CachyOS ships with systemd compiled with+SECCOMPsupport, but there are no audit entries for blocked syscalls. Kernel is6.19.9-2-cachyos(standard, not hardened).Summary so far:
This narrows it down to Claude Code's specific process spawning/output capture layer, possibly the bundled Bun 1.2 or the wrapper around it.
Great debugging — you've conclusively isolated this to Claude Code's internal Bash tool pipe handling rather than system config. Since the file-redirection workaround works, that confirms the issue is in how CC captures stdout from its bundled Bun runtime on certain Linux distros. Hopefully the CC team picks this up as a confirmed platform bug.
Your systematic debugging is excellent — ruling out shell config, kernel security, system Bun, and narrowing it down to Claude Code's bundled Bun 1.2 pipe capture, all with concrete evidence at each step. This is the kind of root cause analysis that makes it easy for the platform team to fix.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
Seems to be a duplicate of https://github.com/anthropics/claude-code/issues/19663.
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.