Improve Claude Code errors and create Docs (#4968)

* Create docs

* Improve the Claude Code error messages

* Replace with remote image
This commit is contained in:
Tomás Barreiro authored and GitHub committed 2025-07-16 18:22:01 -07:00
1 parent c50fce8101
commit b18ad77539
3 files changed
+61 -2

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": patch
---
Improve the Claude Code error messages
+25
View File
@@ -32,6 +32,31 @@ First, you'll need to install and authenticate Claude Code on your system:
/>
</Frame>
<br />
<Accordion title="Windows Setup">
On Windows, Cline supports integrating with Claude Code through WSL.
Windows doesn't support long commands, and Claude Code only accepts the system prompt through a flag, which means we can't properly prompt Claude through Claude Code. Anthropic is [working on a workaround to streamline this](https://github.com/anthropics/claude-code/issues/3411).
1. **Make sure you have WSL set-up**. You can follow [this](https://code.visualstudio.com/docs/remote/wsl#_installation) guide to do it.
2. **Open VSCode from WSL** and verify it's properly set-up. You should see an indicator in the bottom left that says "WSL". You can find an image of the indicator [here](https://code.visualstudio.com/docs/remote/wsl#_from-the-wsl-terminal).
3. Install Cline within WSL and make sure it shows the following:
<Frame>
<img
src="https://storage.googleapis.com/cline_public_images/docs/assets/cline_wsl_installed_extension.webp"
alt="Indicator that an extension is installed on WSL"
/>
</Frame>
4. Clone or [move](https://stackoverflow.com/a/42586455) your project over to WSL
5. Follow the [instructions on how to set up Claude Code normally](#setup), but from the WSL terminal.
</Accordion>
### Finding your Claude Code path
If you're not sure where Claude Code is installed:
+31 -2
View File
@@ -76,10 +76,39 @@ export async function* runClaudeCode(options: ClaudeCodeOptions): AsyncGenerator
)
}
} catch (err) {
// When the command fails, execa throws an error with the arguments, which include the whole system prompt.
// We want to log that, but not show it to the user.
console.error(`Error during Claude Code execution:`, err)
if (err instanceof Error) {
if (err.message.includes("ENOENT")) {
throw new Error(
`Failed to find the Claude Code executable.
Make sure it's installed and available in your PATH or properly set in your provider settings.`,
{ cause: err },
)
}
if (err.message.includes("E2BIG")) {
throw new Error(
`Executing Claude Code failed due to a long system prompt. The maximum argument length is 131072 bytes.
Rules and workflows contribute to a longer system prompt, consider disabling some of them temporarily to reduce the length.
Anthropic is aware of this issue and is considering a fix: https://github.com/anthropics/claude-code/issues/3411.
`,
{ cause: err },
)
}
if (err.message.includes("ENAMETOOLONG")) {
throw new Error(
`Executing Claude Code failed due to a long system prompt. Windows has a limit of 8191 characters, which makes the integration with Cline not work properly.
Please check our docs on how to integrate Claude Code with Cline on Windows: https://docs.cline.bot/provider-config/claude-code#windows-setup.
Anthropic is aware of this issue and is considering a fix: https://github.com/anthropics/claude-code/issues/3411.
`,
{ cause: err },
)
}
// When the command fails, execa throws an error with the arguments, which include the whole system prompt.
// We want to log that, but not show it to the user.
const startOfCommand = err.message.indexOf(": ")
if (startOfCommand !== -1) {
const messageWithoutCommand = err.message.slice(0, startOfCommand).trim()