claude-code - 💡(How to fix) Fix [BUG] CLI-style terminal does not use bundled CLI binary, causing "command not found" error [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46167Fetched 2026-04-11 06:27:22
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Error Message

Error Messages/Logs

  1. command not found error appears

Code Example

command not found: claude
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

What's Wrong?

Bug Description

When switching the Claude Code VS Code extension to "CLI-style" mode, it opens a terminal and runs claude as a shell command. However, the bundled CLI binary is not added to the terminal's PATH, so users who have not separately installed the global CLI will see:

command not found: claude

Current Behavior

GUI mode works fine (uses the bundled binary directly), but CLI mode relies on claude being available in the shell PATH, which is inconsistent and breaks for users who only installed the extension.

Environment

  • VS Code with Claude Code extension installed
  • No global @anthropic-ai/claude-code npm package installed

What Should Happen?

Expected Behavior

The extension should either:

  • Use the bundled binary's absolute path when launching the terminal, OR
  • Clearly prompt the user to install the global CLI if it cannot be found in PATH

Error Messages/Logs

command not found: claude

Steps to Reproduce

Steps to Reproduce

  1. Install the Claude Code VS Code extension (do NOT install the global CLI via npm)
  2. In extension settings, switch UI style to "Terminal / CLI mode"
  3. The extension opens a terminal and attempts to run claude
  4. command not found error appears

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

2.1.97 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

This appears to be a straightforward vscode extension design issue that should be relatively easy to fix.

The extension already bundles its own CLI binary and uses it correctly in GUI mode. The fix should be consistent: when launching a CLI-style terminal, the extension should inject the bundled binary's directory into the terminal's PATH (via Terminal.env in the VS Code API), so the claude command resolves correctly without requiring users to separately install the global CLI or manually configure their PATH.

The alternative — requiring users to install @anthropic-ai/claude-code globally before the CLI-style mode works — is undocumented and inconsistent with the behavior of GUI mode. Users who install only the extension have a reasonable expectation that all its features work out of the box.

Preferred fix: have the extension register its bundled binary's path into the spawned terminal's environment, eliminating the need for a redundant global installation.

Note: I was unsure whether plugin-specific bugs should be reported in a separate repository, so I'm filing this here. Please redirect if there is a more appropriate tracker.

extent analysis

TL;DR

The extension should inject the bundled binary's directory into the terminal's PATH to fix the command not found error when switching to CLI-style mode.

Guidance

  • The issue arises from the extension not adding the bundled CLI binary to the terminal's PATH when launching in CLI-style mode.
  • To verify the fix, check that the claude command is recognized in the terminal after injecting the binary's directory into the PATH.
  • The extension can use the Terminal.env property in the VS Code API to modify the terminal's environment variables, including the PATH.
  • An alternative solution could be to prompt the user to install the global CLI if it cannot be found in the PATH, but this is less consistent with the GUI mode behavior.

Example

// Example of how to modify the terminal's environment variables using the VS Code API
const terminal = vscode.window.createTerminal({
  env: {
    PATH: `${pathToBundledBinaryDirectory}:${process.env.PATH}`,
  },
});

Notes

The fix should be applied to the VS Code extension code, specifically when launching a terminal in CLI-style mode. The exact implementation details may vary depending on the extension's internal architecture.

Recommendation

Apply workaround: inject the bundled binary's directory into the terminal's PATH. This approach is more consistent with the GUI mode behavior and eliminates the need for a redundant global installation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING