Nextflow language server v1.0.1 - fails parsing a main.nf

I am using vscode

Version: 1.95.3
Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813
Date: 2024-11-13T14:50:04.152Z
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Darwin x64 23.6.0

with the recent v1.0.1 release of the nextflow language server using JDK v23.

Sadly it emits the stack trace below. The progress text reads “Initializing workspace:…” and doesn’t seem to progress. The main.nf it was asked to parse is a 1000 lines or so which I have been using for a few years. From the error message, it is unclear what caused the server to fail. Of course, I would like to isolate the code segment but also I just wanted to provide some feedback.

Nov 15, 2024 5:21:46 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleNotification
WARNING: Notification threw an exception: {
  "jsonrpc": "2.0",
  "method": "workspace/didChangeConfiguration",
  "params": {
    "settings": {
      "nextflow": {
        "debug": false,
        "files": {
          "exclude": [
            ".git",
            ".nf-test",
            "work"
          ]
        },
        "formatting": {
          "harshilAlignment": false
        },
        "java": {},
        "suppressFutureWarnings": true
      }
    }
  }
}
java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.lang.String (java.util.ArrayList and java.lang.String are in module java.base of loader 'bootstrap')
	at nextflow.lsp.services.script.VariableScopeVisitor.declareParameters(VariableScopeVisitor.java:274)
	at nextflow.lsp.services.script.VariableScopeVisitor.visitWorkflow(VariableScopeVisitor.java:213)
	at nextflow.script.v2.ScriptVisitorSupport.visit(ScriptVisitorSupport.java:36)
	at nextflow.lsp.services.script.VariableScopeVisitor.visit(VariableScopeVisitor.java:176)
	at nextflow.lsp.services.script.ResolveVisitor.visit(ResolveVisitor.java:93)
	at nextflow.lsp.services.script.ScriptAstCache.buildAST(ScriptAstCache.java:109)
	at nextflow.lsp.ast.ASTNodeCache.lambda$update$0(ASTNodeCache.java:91)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:215)
	at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1716)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:727)
	at nextflow.lsp.ast.ASTNodeCache.update(ASTNodeCache.java:94)
	at nextflow.lsp.services.LanguageService.initialize(LanguageService.java:136)
	at nextflow.lsp.services.script.ScriptService.initialize(ScriptService.java:53)
	at nextflow.lsp.NextflowLanguageServer.didChangeConfiguration(NextflowLanguageServer.java:454)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$recursiveFindRpcMethods$0(GenericEndpoint.java:65)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:160)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:231)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:198)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:185)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:97)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:114)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	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.lang.Thread.run(Thread.java:1575)

Nov 15, 2024 5:21:46 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 2
Nov 15, 2024 5:21:46 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 4
Nov 15, 2024 5:21:46 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 1
Nov 15, 2024 5:21:46 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 3
Nov 15, 2024 5:21:46 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 6
Nov 15, 2024 5:21:46 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 7

Thanks for reporting. Looks like the same as this issue. Basically, I didn’t realize the “type” property in the parameter JSON schema could be an array of strings, and on top of that the error isn’t handled gracefully.

This will be fixed in the next update, but for now you can just remove any array types in your JSON schema, just use one type for now.

2 Likes

Solved in 01d9722 and released as part of v1.0.2.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.