biomejs / biome-vscode

Biome extension for Visual Studio Code and VSCodium
https://marketplace.visualstudio.com/items?itemName=biomejs.biome
Apache License 2.0
235 stars 32 forks source link

🐛 You must have at least one workspace #365

Open johnlindquist opened 2 months ago

johnlindquist commented 2 months ago

VS Code version

Cursor 0.41.3

Extension version

biome-2024.9.200949

Biome version

1.9.2

Operating system

Description

2024-09-26 16:20:57.099 [info] Biome encountered an unexpected error

This is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https://github.com/biomejs/biome/issues/ along with the following information to help us fixing the issue:

Source Location: crates/biome_service/src/settings.rs:75:14 Thread Name: tokio-runtime-worker Message: You must have at least one workspace.

2024-09-26 16:20:57.103 [info] [Error - 4:20:57 PM] Handling connection error failed 2024-09-26 16:20:57.103 [info] TypeError: Cannot read properties of undefined (reading 'toString') at Object.error (/Users/johnlindquist/.cursor/extensions/biomejs.biome-2024.9.200949/out/index.js:48582:28) at BiomeLanguageClient.handleConnectionError (/Users/johnlindquist/.cursor/extensions/biomejs.biome-2024.9.200949/out/index.js:47045:71) at errorHandler (/Users/johnlindquist/.cursor/extensions/biomejs.biome-2024.9.200949/out/index.js:46991:19) at /Users/johnlindquist/.cursor/extensions/biomejs.biome-2024.9.200949/out/index.js:47374:37 at CallbackList.invoke (/Users/johnlindquist/.cursor/extensions/biomejs.biome-2024.9.200949/out/index.js:30421:40) at Emitter.fire (/Users/johnlindquist/.cursor/extensions/biomejs.biome-2024.9.200949/out/index.js:30483:37) at writeErrorHandler (/Users/johnlindquist/.cursor/extensions/biomejs.biome-2024.9.200949/out/index.js:31532:23) at CallbackList.invoke (/Users/johnlindquist/.cursor/extensions/biomejs.biome-2024.9.200949/out/index.js:30421:40) at Emitter.fire (/Users/johnlindquist/.cursor/extensions/biomejs.biome-2024.9.200949/out/index.js:30483:37) at StreamMessageWriter.fireError (/Users/johnlindquist/.cursor/extensions/biomejs.biome-2024.9.200949/out/index.js:30975:28) at Socket. (/Users/johnlindquist/.cursor/extensions/biomejs.biome-2024.9.200949/out/index.js:31012:48) at Socket.emit (node:events:514:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) 2024-09-26 16:20:57.103 [info] [Error - 4:20:57 PM] Sending document notification textDocument/didOpen failed 2024-09-26 16:20:57.103 [info] Error: write EPIPE at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) 2024-09-26 16:20:57.104 [info] [Error - 4:20:57 PM] Biome language server error 2024-09-26 16:20:57.104 [info] [Error - 4:20:57 PM] Request textDocument/codeAction failed. 2024-09-26 16:20:57.104 [info] Message: Cannot call write after a stream was destroyed Code: -32099 2024-09-26 16:20:57.104 [info] [Error - 4:20:57 PM] Connection to server got closed. Server will not be restarted. 2024-09-26 16:20:57.104 [info] [Error - 4:20:57 PM] Stopping server failed 2024-09-26 16:20:57.104 [info] Message: Cannot call write after a stream was destroyed Code: -32099 2024-09-26 16:20:57.104 [info] [Error - 4:20:57 PM] Stopping server failed 2024-09-26 16:20:57.104 [info] Message: Cannot call write after a stream was destroyed Code: -32099 2024-09-26 16:24:55.531 [info] Biome encountered an unexpected error

Steps to reproduce

Simple open your project

Expected behavior

for it to work

Does this issue occur when using the CLI directly?

Not sure / Not applicable

Link to a minimal reproduction

No response

Logs

No response

nhedger commented 1 month ago

I've been trying to reproduce this issue for quite some time.

Any chance you're able to reproduce it consistently? If so any additional information would help troubleshooting this.

KurtGokhan commented 1 month ago

I had this issue with a new project I created. Latest VSCode stable version. I tried these but couldn't solve the problem:

Then I tried these and some of them must have worked because it started working suddenly:

Hope this helps.

imertz commented 1 month ago

I had this issue with a new project I created. Latest VSCode stable version. I tried these but couldn't solve the problem:

  • Installed all 1.9.x versions individually. None worked.
  • Restarted VSCode, Extensions, LSP server. None worked.
  • Tried both the latest release and pre-release version of this extension. Although, the latest release version reports a different error with less details (data 393).

Then I tried these and some of them must have worked because it started working suddenly:

  • I noticed I had another VSCode workspace open. So I closed it.
  • Installed Biome v1.8.3 then reinstalled v1.9.3 again.
  • I noticed there was 1 minor issue in my Biome config. Fixed that.

Hope this helps.

Worked! Thanks!

larsks commented 4 days ago

Hi there; I'm running neovim 0.10.2 with biome 1.9.4. When I open a javascript file, biome logs the message:

[ERROR][2024-11-24 15:03:34] .../vim/lsp/rpc.lua:770 "rpc" "/home/lars/.local/share/nvim/mason/bin/biome" "stderr" "Biome encountered an unexpected error\n\nThis is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https://github.com/biomejs/biome/issues/ along with the following information to help us fixing the issue:\n\nSource Location: crates/biome_service/src/settings.rs:78:14\nThread Name: tokio-runtime-worker\nMessage: You must have at least one workspace.\n\n"

I was going to open a new issue as requested, but the error suggests this is the same problem.

The error occurs when the directory from which I started neovim contains a biome.json file. Without the biome.json file, :LspInfo shows root directory: Not found.

larsks commented 4 days ago

Ah, in this case, the message is a lie: the problem is that I had an empty biome.json file, which is invalid; if the file instead contains an empty json object ({}), it seems to work as expected.