claude-code-webui icon indicating copy to clipboard operation
claude-code-webui copied to clipboard

[Bug]: I get "Claude Code process exited with code 1" when I send a message

Open hsablonniere opened this issue 1 year ago • 8 comments

Issue Type

  • [x] 🐛 bug - Bug fix (non-breaking change which fixes an issue)
  • [ ] 🖥️ backend - Backend-related issue
  • [ ] 🎨 frontend - Frontend-related issue

Component

Not sure

Bug Description

When I send the message, I get this:

Image

Steps to Reproduce

  1. Start server with claude-code-webui
  2. Browse http://localhost:8080
  3. Select a project
  4. Type "hello"

Expected Behavior

Get an answer like Hello! How can I help you today?

Actual Behavior

I get this error:

⚙ Error(stream_error)▼
Claude Code process exited with code 1

Operating System

Linux (x64)

Installation Method

npm install -g @anthropic-ai/claude-code-webui

Node.js Version

v22.18.0

Deno Version (if applicable)

No response

Claude CLI Version

1.0.67

Claude CLI Installation Path

/home/hsablonniere/.local/bin/claude

Browser (for frontend issues)

Firefox

Console Logs/Error Messages


Configuration


Additional Context

No response

Checklist

  • [x] I have searched existing issues to make sure this is not a duplicate
  • [x] I have provided all the required information above
  • [x] I have removed any sensitive information from logs and configuration

hsablonniere avatar Aug 04 '25 00:08 hsablonniere

@sugyan Interesting project by the way, looking forward to use it 😉 Let me know if you need more details.

hsablonniere avatar Aug 04 '25 00:08 hsablonniere

Thank you for the detailed bug report!

Debugging Steps: Since your Claude CLI version (1.0.67) is confirmed, let's verify the CLI works with prompt mode:

# 1. Test Claude CLI with prompt mode directly
cd /path/to/your/selected/project
echo "hello" | claude -p

# 2. Run the web UI with debug logging to see detailed error info
claude-code-webui --debug

Please share the console output from both commands, especially any error messages from the debug mode.

Likely Causes:

  • Claude CLI authentication issues in the selected project context
  • Working directory permissions or configuration problems
  • Specific environment issues with Node.js v22.18.0 + Linux combination

The debug logs will help us identify exactly where the process is failing.

sugyan avatar Aug 04 '25 23:08 sugyan

Hey @sugyan, thanks for your answer.

cd /to/project
echo "hello" | claude -p
# Hello! I'm Claude Code, ready to help you with your software engineering tasks. How can I assist you today?

When I start it:

claude-code-webui --debug

🔍 Searching for Claude CLI in PATH...
[DEBUG] Found Claude CLI candidates: /home/hsablonniere/.local/bin/claude
[DEBUG] Using Claude CLI path: /home/hsablonniere/.local/bin/claude
🔍 Detecting actual Claude CLI script path...
⚠️  CLI script detection failed, using original path: /home/hsablonniere/.local/bin/claude
✅ Claude CLI found: 1.0.69 (Claude Code)
🐛 Debug mode enabled
🚀 Server starting on 127.0.0.1:8080
Listening on http://127.0.0.1:8080/

When I type "hello" in the web chat:

[DEBUG] Received chat request: {
  "message": "hello",
  "requestId": "6b152957-4057-4deb-87df-48225a217c2c",
  "allowedTools": [],
  "workingDirectory": "/home/hsablonniere/dev/gnome-key-switcher"
}
Claude Code execution failed: Error: Claude Code process exited with code 1
    at ChildProcess.<anonymous> (file:///home/hsablonniere/.volta/tools/image/packages/claude-code-webui/lib/node_modules/claude-code-webui/node_modules/@anthropic-ai/claude-code/sdk.mjs:224:25)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1101:16)
    at Socket.<anonymous> (node:internal/child_process:456:11)
    at Socket.emit (node:events:518:28)
    at Pipe.<anonymous> (node:net:346:12)
  • The project directory is drwxr-xr-x
  • I updated claude, and the web UI before running this test:
    • claude -v => 1.0.69 (Claude Code)
    • claude-code-webui -v => 0.1.45
    • node -v => v22.17.1
  • Claude Code Web UI installed via npm -g (handled by volta on my system)
  • Claude installed via the new native installer

hsablonniere avatar Aug 06 '25 10:08 hsablonniere

Got the same error on Mac. The development version works fine, but even after building it locally I got the same error.

JulianDeal avatar Aug 06 '25 19:08 JulianDeal

Thank you for the detailed debug logs! I can see the issue now.

The problem is that this application needs to detect the actual CLI script path (cli.js) for Claude execution, and our auto-detection mechanism doesn't work properly with Volta-managed installations.

As a workaround, could you try running with the --claude-path option to specify the actual Claude path:

claude-code-webui --claude-path "$(volta which claude)" --debug

This should bypass our auto-detection and use the path that Volta resolves. Let me know if this resolves the issue!

sugyan avatar Aug 09 '25 09:08 sugyan

Hey @sugyan, thanks for you answer.

  • I actually updated my Claude Code install to not be via volta (using the native install)
    • Your command didn't work
  • I tried to reinstall Claude Code via volta
    • Your command worked, it's great thank you

I'm wondering if there's just one bug (where volta is used) or 2 with one where Claude Code is not installed via npm.

Anyway, thanks for this project, I'll have a go at it now!

hsablonniere avatar Aug 10 '25 23:08 hsablonniere

Thanks for the detailed follow-up @hsablonniere! This helps clarify the situation.

Great to hear that the Volta workaround with --claude-path "$(volta which claude)" works as expected - that should provide a reliable solution for Volta users.

Regarding the native installer issue, I've opened https://github.com/anthropics/claude-code/issues/5823 to investigate this upstream. The problem appears to be that the TypeScript SDK (which claude-code-webui depends on) currently doesn't support native binary installations - it expects Claude Code to be installed via npm/pnpm/yarn package managers.

Based on this investigation, it looks like we have two distinct issues:

  1. Volta environment: ✅ Resolved with --claude-path "$(volta which claude)" workaround
  2. Native installer: ⚠️ Not currently supported due to TypeScript SDK limitations

I think we should update our documentation to clarify that claude-code-webui currently requires Claude Code to be installed via npm, pnpm, yarn, or similar package managers, and doesn't support the native binary installation method. This would help users understand the installation requirements upfront.

Thanks for helping identify these compatibility constraints!

sugyan avatar Aug 15 '25 07:08 sugyan

This issue has been resolved! 🎉

Update on Native Binary Installation Support

Great news @hsablonniere! The native binary installation issue that was identified in this thread has now been resolved:

  • Upstream fix: anthropics/claude-code#5823 has been resolved, allowing the Claude Code SDK to work with native installations
  • Our fix: PR #270 updated the validation logic to gracefully handle script path detection failures while still allowing the application to work with native installations
  • Available now: This fix is included in the latest release v0.1.51

What Works Now

  1. Volta environments: Continue using --claude-path "$(volta which claude)" as before ✅
  2. Native binary installations: Now supported! The app will show warnings during startup about script path detection failing, but will work correctly as long as the Claude executable path is valid ✅

The warnings you might see are expected and don't prevent functionality - they're just informing you that the advanced script path detection couldn't resolve the internal structure, but the fallback to using the executable directly works fine.

Thanks for the detailed debugging help and patience with this issue! If you encounter any further issues with either installation method, please feel free to open a new issue.

sugyan avatar Sep 06 '25 15:09 sugyan