[Desktop/Windows] Every Bash tool call fails with "unexpected EOF while looking for matching `'" - suspected unescaped apostrophe from auto-generated org name

Status Open
Reported on v2.1.221
Maintainer reply None cached
Activity 0 comments · opened Aug 4, 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 Desktop app on Windows 11 Pro (10.0.26200), shell: Git Bash (/usr/bin/bash)
  • Standalone CLI 2.1.221 on the SAME machine, SAME project dir, SAME config: Bash tool works fine
  • Desktop app reports it is up to date

What happened
Mid-session (no local config change, no restart in between), every Bash tool invocation in the desktop app started failing with:

/usr/bin/bash: -c: line 82: unexpected EOF while looking for matching `'

Even a bare echo alive fails. The line number stays constant (82) across:

  • full process kill + restart (fresh shell snapshots ARE generated - clean, 44 lines, balanced quoting)
  • app reinstall
  • sandbox bypass mode (dangerouslyDisableSandbox: true)
  • adding/removing permission allow rules, disabling plugins (claude-mem); no .bashrc/.bash_profile present; no env var value contains a quote (verified)

Since the error is reported at the END of the -c script, the wrapper the app builds in memory has an unterminated single quote, and that wrapper is ~82 lines long.

Suspected cause
Onset coincided exactly with a profile refetch (profileFetchedAt in ~/.claude.json updated minutes earlier). Our auto-generated organizationName has the form <email>'s Organization - it contains an apostrophe and is the ONLY apostrophe-bearing string in all account/session data. Hypothesis: the desktop app injects account/org metadata into the per-command bash wrapper without shell-escaping it, so that apostrophe terminates a quote early.

Hard to verify locally: patching organizationName in ~/.claude.json does not survive app start - the app restores the old value from its internal Electron store WITHOUT a server fetch (profileFetchedAt unchanged). A Max plan has no UI to rename the organization, so the apostrophe cannot be removed at the source either.

What Should Happen?

Bash tool executes commands in the desktop app. Account/org metadata injected into the shell wrapper must be shell-escaped - an apostrophe in the auto-generated org name "<email>'s Organization" must not break every Bash invocation. A way to rename the auto-generated organization (or support renaming on request) would also give affected users a workaround.

Error Messages/Logs

/usr/bin/bash: -c: line 82: unexpected EOF while looking for matching `'
(exit code 2; identical for every command, including a bare: echo alive)

Earlier the same day the line number was 79; it changed to 82 as the session's MCP set changed, then stayed constant at 82 across restarts, reinstall and all config changes.

Steps to Reproduce

  1. Use a claude.ai account whose auto-generated organization name contains an apostrophe (default format: <email>'s Organization).
  2. Open the Claude DESKTOP app on Windows, start a session in any project (Git Bash present).
  3. Ask for any Bash command, e.g. echo alive.
  4. Every Bash tool call fails with: /usr/bin/bash: -c: line 82: unexpected EOF while looking for matching `'
  5. Run standalone CLI 2.1.221 in the same directory with the same config - Bash works there.

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

1.24012.11.0_x64

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

  • Shell snapshots in ~/.claude/shell-snapshots are regenerated on restart and are clean (44 lines, balanced quotes), so the unterminated quote is in the in-memory part of the wrapper.
  • Verified not caused by: settings.json / settings.local.json allow rules (user, project and parent dir), plugins (claude-mem disabled), MCP terminal server, .env files, environment variables, sandbox mode.
  • The desktop app is the only affected surface; the CLI on the same machine is unaffected.

View original on GitHub ↗