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

+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()