Repository navigation
fix(ai): show friendly error when opencode CLI is unavailable - #1669
Merged
backnotprop merged 2 commits intoOct 3, 2026
Merged
backnotprop merged 2 commits into
backnotprop merged 2 commits into
Conversation
…#1503) When createOpencodeServer fails with ENOENT (e.g. opencode CLI not installed or missing from PATH), wrap and rethrow with an actionable error message advising the user to install the CLI or disable the provider, rather than letting raw uv_spawn ENOENT bubble up.
The message fallback (/ENOENT|not found/i) also matched the SDK's 'Server exited with code N' failures, which embed the child's stderr, so an unrelated 'model not found' was misreported as a missing CLI. Node, Bun and cross-spawn all set code ENOENT on a missing binary. Reword the message to name the binary, link the install page, and point at choosing another AI provider (there is no per-provider disable). Tests assert the cause is preserved and that other failures pass through.
Owner
|
Thanks @Aayushyaash, merged. I pushed one small change on top: it now detects a missing CLI by the error's |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1503
Summary
When the
opencodeCLI is not installed or is not available onPATH, theopencode-sdkprovider previously showed a rawENOENTerror.This PR replaces it with a clear error message explaining that the CLI is missing and how to resolve it.
Changes
ENOENTerrors when starting the OpenCode server.opencodeCLI is unavailable.Verification
bun test packages/ai/providers/opencode-sdk.test.ts— 8/8 passingbun test packages/ai/— 146/146 passingtsc --noEmit -p packages/ai/tsconfig.json— 0 errorsPATHcleared that the friendly error is shown instead of the rawENOENTerror.