[BUG] v2.1.105 shell snapshot contains 'set -o onecmd', causing all Bash tool calls to produce no output

Resolved 💬 3 comments Opened Apr 14, 2026 by namse Closed Jun 21, 2026

Preflight Checklist

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

What's Wrong?

Environment

  • Claude Code: 2.1.105 (native installer, ~/.local/bin/claude)
  • OS: Debian (Linux 6.12)
  • bash: GNU bash 5.2.37(1)-release
  • npm latest published: 2.1.104 (native-track only regression)

## Symptom
Every Bash tool call (and REPL ! <cmd>) returns (No output) with exit code 1. Debug log shows:

[DEBUG] Creating shell snapshot for bash (/bin/bash)
[DEBUG] Shell snapshot created successfully (2444 bytes)
[DEBUG] Spawning shell without login (-l flag skipped)
[DEBUG] Bash tool error (12ms): Shell command failed

## Root cause
The generated shell snapshot at ~/.claude/shell-snapshots/snapshot-bash-<ts>-<rand>.sh contains:

set -o onecmd

onecmd (equivalent to set -t) makes the shell exit after executing one command. Because the snapshot is sourced
before the user's command runs, bash exits before the actual command executes — hence empty stdout/stderr and exit 1.

## Workaround
sed -i '/^set -o onecmd$/d' ~/.claude/shell-snapshots/*.sh after the first bash call restores functionality for
that session.

## Suggested fix
Filter onecmd (and other transient one-shot flags) out of the dumped set -o state, or explicitly emit set +o
onecmd
at the start of every snapshot.

What Should Happen?

The command executed after ! echo ok (or any Bash tool call) should run normally and return its stdout/stderr with a
proper exit code. For ! echo ok, the output should be ok.

Error Messages/Logs

Steps to Reproduce

  1. Update to native 2.1.105
  2. Start claude, run ! echo ok — output is empty
  3. Inspect ~/.claude/shell-snapshots/*.sh — contains set -o onecmd

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

maybe 2.1.103 or 2.1.104

Claude Code Version

2.1.105

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗