fix: Windows LSP URIs using backslashes (Biome initialization failure)#5317
Merged
Conversation
Collaborator
|
/review |
Contributor
|
lgtm |
Contributor
Author
|
If anything else is needed tell me |
xywsxp
pushed a commit
to xywsxp/opencode
that referenced
this pull request
Apr 24, 2026
Rwanbt
pushed a commit
to Rwanbt/opencode
that referenced
this pull request
May 5, 2026
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
avion23
pushed a commit
to avion23/opencode
that referenced
this pull request
Jun 10, 2026
Rwanbt
pushed a commit
to Rwanbt/opencode
that referenced
this pull request
Jun 14, 2026
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.
Summary
On Windows, the LSP client is currently sending URIs built from Windows paths with backslashes (
\). This results in invalidfile://URIs and causes strict LSP servers like Biome to fail duringinitializewith a URI parsing error (e.g. “unexpected character at index 9”).LSP requires URIs conforming to RFC 3986, which uses
/as the path separator even on Windows (e.g.file:///c:/project/file.ts).Evidence
{ "$schema": "https://opencode.ai/config.json", "lsp": { "typescript":{ "disabled": true }, "biome": { "command": [ "bunx", "@biomejs/biome@latest", "lsp-proxy", "--stdio" ], "extensions": [ ".js", ".mjs", ".cjs", ".jsx", ".ts", ".mts", ".cts", ".tsx", ".d.ts", ".d.mts", ".d.cts", ".json", ".jsonc", ".css", ".html", ".htm", ".graphql", ".gql", ".vue", ".svelte", ".astro" ] } } }Example log when opening a file on Windows:
This matches what you’d expect if the LSP server receives a URI like:
instead of:
Current Fix
I’ve implemented a change so that, when building URIs from filesystem paths, we now use:
This is done to let Node handle the
file://URI normalization (including converting backslashes to forward slashes and properly encoding the path).On Windows, this fixes the issue in my tests: Biome now initializes correctly and works as expected.
Fix Evidence
Disclaimer / Request for Review
I’m not very experienced with URI edge cases (UNC paths, non-ASCII, already-encoded paths, etc.), so while
pathToFileURL(item).hreflooks like the correct and simplest solution, I’m not 100% sure there are no side effects on other platforms or setups.Feel free to offer improvements, comments, or whatever. And do some extra testing before merging this.