Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

biome server bugs out on config, CLI works with the same. #83

Closed
LaravelFreelancerNL opened this issue Aug 29, 2024 · 17 comments · Fixed by #132
Closed

biome server bugs out on config, CLI works with the same. #83

LaravelFreelancerNL opened this issue Aug 29, 2024 · 17 comments · Fixed by #132

Comments

@LaravelFreelancerNL
Copy link

LaravelFreelancerNL commented Aug 29, 2024

I've got Biome setup with PhpStorm. It works perfectly fine from the commandline.
However the 'integrated server' fails for automated fixes with the following error on startup:

"Biome: The configuration file has errors. Biome will report only parsing errors until the configuration is fixed."

System: W11 with WSL2-ubuntu
PhpStorm: 2024.2.0.1
Biome: 1.8.3

Devdependencies:
"@biomejs/biome": "1.8.3",
"@biomejs/cli-linux-x64": "^1.8.3",
"@biomejs/cli-win32-x64": "^1.8.3",

PhpStorm Biome settings:

  • Automatic Biome configuration
  • Run biome for files: **/*.{js,mjs,mts,cjs,ts,jsx,tsx,cts,json,jsonc,vue,svelte,astro,css}
  • Run format on save.
  • Run safe fixes on save

biome.json in root of the project

{
    "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
    "formatter": {
        "indentStyle": "space",
        "indentWidth": 4,
        "lineWidth": 120
    },
    "linter": {
        "ignore": ["assets", "core", "layouts", "tests", "types"]
    },
    "vcs": {
        "defaultBranch": "master",
        "clientKind": "git",
        "enabled": true,
        "useIgnoreFile": true
    }
}

I don't see anything wrong with this config and running biome format/lint through the CLI works perfectly fine with these settings.

Am I doing something wrong or have I stumbled upon a bug?

With kind regards
Bas.

@ematipico
Copy link
Member

Can you provide a reproduction?

@LaravelFreelancerNL
Copy link
Author

What do you mean by a reproduction in this sense?
These are the exact settings that I'm using and think might be relevant, are you missing anything specific?

The jetbrains plugin fails, the CLI works with these settings (within the same project).

@ematipico
Copy link
Member

With minimal reproduction, I mean the minimal project (repository) where you can reproduce the issue consistently. I have a project very similar to yours, and I don't encounter the issue.

That's why it's important to have a brand you project, because it's possible that there are user settings that might interfere with the project

@LaravelFreelancerNL
Copy link
Author

Sure, I'll set one up over the weekend.

@Richard87
Copy link

Hi, I think i have the same issue, pretty sure it has something to do with WSL and the LSP server, I have the exact same issue in vscode

java.lang.Throwable: Failed to run Biome check with (format, safefixes, unsafefixes) for file biome.json - //wsl.localhost/Ubuntu/home/richard/projects/projectX/biome.json internalError/fs ━━━━━━━━━━

  × Cannot read file
  
  × Biome can't read the following file, maybe for permissions reasons or it doesn't exist: //wsl.localhost/Ubuntu/home/richard/projects/projectX/biome.json
  


	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
	at com.github.biomejs.intellijbiome.actions.BiomeCheckRunner.applyChanges(BiomeCheckRunner.kt:91)
	at com.github.biomejs.intellijbiome.actions.BiomeCheckRunner.access$applyChanges(BiomeCheckRunner.kt:20)
	at com.github.biomejs.intellijbiome.actions.BiomeCheckRunner$formatDocuments$1$1.run(BiomeCheckRunner.kt:58)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:477)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:133)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:528)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:249)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:98)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:221)
	at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:49)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:220)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:98)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:249)
	at com.intellij.openapi.progress.impl.ProgressRunner$ProgressRunnable.run(ProgressRunner.java:501)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$18(ProgressRunner.java:466)
	at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:92)
	at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:92)
	at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:97)
	at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:92)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$19(ProgressRunner.java:464)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)

@LaravelFreelancerNL
Copy link
Author

I can confirm there is some kind of interference from the project itself. I haven't had time to dig deeper than a superficial check.
t.b.c.

@kbytesys
Copy link

This bug is related to the lack of support to wsl. there are other 2 bugs related to the same error.

I don't know if maintainers are planning some kind of support since we are reporting the same problem time by time :p

@Richard87
Copy link

For the record, the fix I posted in the other thread does work nicely for me:

  • winget install "Node.js"
  • possibly restart your terminal
  • Install biome on the hots (npm install -g @biomejs/biome)
  • Manually specify Biome in intellij config: C:\Users\USERNAME\AppData\Roaming\npm\biome.cmd

@kbytesys
Copy link

But this is not a fix, because you are using WSL to avoid to install software in your host (in some company laptops you can't install what you want). The real fix is to use the executable inside WSL.

@dualsoftax
Copy link

Same issue here, any update on this one?

@ematipico
Copy link
Member

ematipico commented Feb 7, 2025

The issue still lacks a reproduction, which was requested months ago.

Also, it's possible the maintainers don't use WSL. If anyone does, please help the project and send a PR to fix the issue.

@dualsoftax
Copy link

I will describe my setup and how to reproduce this:

OS: Windows 10/11
WSL2 linux 24.04
Node 22lts (installed in WSL)
pnpm v10 package manager

I am using latest version of biomejs in my project inside wsl2 and Webstorm as IDE. In webstorm settings I have configured that Node.js interpreter is pulled from WSL Ubuntu as well as package manager pnpm. All other plugins like tailwind, typescript, eslint, prettier work fine and read executable from WSL, except biomejs reporting same issue as described here on top.

com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "\\wsl.localhost\Ubuntu-24.04\home\ax\code\test\node_modules\@biomejs\biome\bin\biome" (in directory "\\wsl.localhost\Ubuntu-24.04\home\ax\code\test"): CreateProcess error=2, The system cannot find the file specified
	at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:384)
	at com.intellij.execution.process.OSProcessHandler.startProcess(OSProcessHandler.java:85)
	at com.intellij.execution.process.OSProcessHandler.<init>(OSProcessHandler.java:45)
	at com.intellij.execution.process.CapturingProcessHandler.<init>(CapturingProcessHandler.java:21)
	at com.github.biomejs.intellijbiome.GeneralProcessCommandBuilder$build$4.<init>(GeneralProcessCommandBuilder.kt:55)
	at com.github.biomejs.intellijbiome.GeneralProcessCommandBuilder.build(GeneralProcessCommandBuilder.kt:55)
	at com.github.biomejs.intellijbiome.lsp.BiomeLspServerDescriptor.startServerProcess(BiomeLspServerSupportProvider.kt:70)
	at com.intellij.platform.lsp.impl.connector.Lsp4jServerConnectorStdio.<init>(Lsp4jServerConnectorStdio.kt:16)
	at com.intellij.platform.lsp.impl.LspServerImpl.Q(LspServerImpl.kt:387)
	at com.intellij.platform.lsp.impl.LspServerImpl.Q(LspServerImpl.kt:354)
	at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport$executeOnPooledThread$1.run(AnyThreadWriteThreadingSupport.kt:167)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at com.intellij.util.concurrency.ContextCallable.lambda$call$1(ContextCallable.java:74)
	at com.intellij.util.concurrency.ContextCallable.call(ContextCallable.java:83)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:101)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:101)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:107)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:101)
	at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.io.IOException: Cannot run program "\\wsl.localhost\Ubuntu-24.04\home\ax\code\test\node_modules\@biomejs\biome\bin\biome" (in directory "\\wsl.localhost\Ubuntu-24.04\home\ax\code\test"): CreateProcess error=2, The system cannot find the file specified

@denbezrukov
Copy link
Contributor

@dualsoftax
Could you try to use the latest nightly version?
https://plugins.jetbrains.com/plugin/22761-biome/versions/nightly/677739

@dualsoftax
Copy link

dualsoftax commented Feb 7, 2025

@denbezrukov There is a new issue now. Plugin is not restarting it is working except it is showing this error:

Biome: The configuration file has errors. Biome will report only parsing errors until the configuration is fixed.

Image

here is the default config I am using in my repo.

{ "$schema": "https://biomejs.dev/schemas/1.8.0/schema.json", "organizeImports": { "enabled": true }, "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true }, "formatter": { "indentStyle": "space" }, "javascript": { "formatter": { "quoteStyle": "single" } }, "css": { "parser": { "cssModules": true } }, "linter": { "enabled": true, "rules": { "recommended": true } } }

@dualsoftax
Copy link

java.lang.IllegalStateException: There is no ProgressIndicator or Job in this thread, the current job is not cancellable. at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable$lambda$0(coroutines.kt:142) at com.intellij.openapi.progress.ContextKt.prepareThreadContext(context.kt:85) at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable(coroutines.kt:140) at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable(coroutines.kt:123) at com.intellij.execution.wsl.WslIjentUtil.runProcessBlocking(WslIjentUtil.kt:68) at com.intellij.execution.wsl.WSLDistribution.lambda$patchCommandLine$2(WSLDistribution.java:245) at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:463) at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:469) at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:374) at com.intellij.execution.wsl.target.WslTargetEnvironment.createProcess(WslTargetEnvironment.kt:129) at com.intellij.javascript.nodejs.execution.NodeTargetRun.startProcessEx(NodeTargetRun.kt:183) at com.github.biomejs.intellijbiome.NodeProcessCommandBuilder.build(NodeProcessCommandBuilder.kt:60) at com.github.biomejs.intellijbiome.lsp.BiomeLspServerDescriptor.startServerProcess(BiomeLspServerSupportProvider.kt:71) at com.intellij.platform.lsp.impl.connector.Lsp4jServerConnectorStdio.<init>(Lsp4jServerConnectorStdio.kt:16) at com.intellij.platform.lsp.impl.LspServerImpl.Q(LspServerImpl.kt:387) at com.intellij.platform.lsp.impl.LspServerImpl.Q(LspServerImpl.kt:354) at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport$executeOnPooledThread$1.run(AnyThreadWriteThreadingSupport.kt:167) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) at com.intellij.util.concurrency.ContextCallable.lambda$call$1(ContextCallable.java:74) at com.intellij.util.concurrency.ContextCallable.call(ContextCallable.java:83) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:101) at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:101) at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:107) at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:101) at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732) at java.base/java.security.AccessController.doPrivileged(AccessController.java:400) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732) at java.base/java.lang.Thread.run(Thread.java:1583)

@pxDot
Copy link

pxDot commented Feb 20, 2025

@denbezrukov the same error (#83 (comment)) for me with the latest nightly version.

@pxDot
Copy link

pxDot commented Feb 21, 2025

I tried investigating a bit. These are the only logs I've found in %LOCALAPPDATA%/JetBrains/PhpStorm2024.3/log/idea.log regarding this:

2025-02-21 11:21:52,722 [12938419]   INFO - #c.i.p.l.i.LspServerImpl - BiomeLspServerDescriptor@[redacted](Initializing;0): Starting LSP server
2025-02-21 11:21:52,850 [12938547]   INFO - #c.i.e.wsl - WSL mount root for Ubuntu is /mnt/ (done in 122 ms)
2025-02-21 11:21:52,850 [12938547]   INFO - #c.i.p.l.i.LspServerImpl - BiomeLspServerDescriptor@[redacted](Initializing;0): LSP server process started: /home/[redacted]/.nvm/versions/node/v22.13.0/bin/node /home/[redacted]/Code/[redacted]/[redacted]/node_modules/@biomejs/biome/bin/biome lsp-proxy --config-path //wsl.localhost/Ubuntu/home/[redacted]/Code/[redacted]/[redacted]
2025-02-21 11:21:52,882 [12938579]   INFO - #c.i.p.l.i.LspServerImpl - BiomeLspServerDescriptor@[redacted](Running;0): LSP server initialized in 0,165s, name = biome_lsp, version = 1.9.4
2025-02-21 11:21:52,893 [12938590]   INFO - #c.i.p.l.i.LspServerImpl - BiomeLspServerDescriptor@[redacted](Running;7): window/logMessage Error: Cannot read file
2025-02-21 11:21:52,893 [12938590]   INFO - #c.i.p.l.i.LspServerImpl - BiomeLspServerDescriptor@[redacted](Running;7): window/showMessage: The configuration file has errors. Biome will report only parsing errors until the configuration is fixed.
2025-02-21 11:21:52,893 [12938590]   INFO - #c.i.p.l.i.LspServerImpl - BiomeLspServerDescriptor@[redacted](Running;7): window/logMessage Info: Server initialized with PID: 44744

And the IDE showing these errors:

Image

The biome.json configuration file is in the root project directory where the root package.json is. Everything is working fine when running the biome CLI directly with the same biome.json but the IDE Plugin does not work.

Setting the executable and biome.json paths manually in the IDE plugin settings will cause the issue described in #83 (comment) again)

Let me know if I can help with more information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants