kotlin-language-server
kotlin-language-server copied to clipboard
Null pointer exception when the language server starts
trafficstars
I get this line whenever language server starts. The lsp still continues to function but this message happens every now and then.
I'm also not sure if the first warning related to SLF4J is related to language server or my system.
[ERROR][2023-06-22 23:41:10] .../vim/lsp/rpc.lua:734 "rpc" "kotlin-language-server" "stderr" "Jun 22, 2023 11:41:10 PM org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint lambda$recursiveFindRpcMethods$2\nSEVERE: A delegate object is null, jsonrpc methods of 'public default org.eclipse.lsp4j.services.NotebookDocumentService org.eclipse.lsp4j.services.LanguageServer.getNotebookDocumentService()' are ignored\n"
[ERROR][2023-06-22 23:41:10] ...lsp/handlers.lua:535 "main A delegate object is null, jsonrpc methods of 'public default org.eclipse.lsp4j.services.NotebookDocumentService org.eclipse.lsp4j.services.LanguageServer.getNotebookDocumentService()' are ignored"
[ERROR][2023-06-22 23:41:24] .../vim/lsp/rpc.lua:734 "rpc" "kotlin-language-server" "stderr" 'Jun 22, 2023 11:41:24 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError\nSEVERE: Internal error: java.lang.NullPointerException: Cannot invoke "org.eclipse.lsp4j.jsonrpc.messages.Either.getLeft()" because the return value of "org.eclipse.lsp4j.Diagnostic.getCode()" is null\njava.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "org.eclipse.lsp4j.jsonrpc.messages.Either.getLeft()" because the return value of "org.eclipse.lsp4j.Diagnostic.getCode()" is null\n\tat java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)\n\tat java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)\n\tat java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n\tat java.base/java.lang.Thread.run(Thread.java:833)\nCaused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.lsp4j.jsonrpc.messages.Either.getLeft()" because the return value of "org.eclipse.lsp4j.Diagnostic.getCode()" is null\n\tat org.javacs.kt.codeaction.quickfix.AddMissingImportsQuickFix.getUnresolvedReferencesFromDiagnostics(AddMissingImportsQuickFix.kt:40)\n\tat org.javacs.kt.codeaction.quickfix.AddMissingImportsQuickFix.compute(AddMissingImportsQuickFix.kt:18)\n\tat org.javacs.kt.codeaction.CodeActionKt.getQuickFixes(CodeAction.kt:47)\n\tat org.javacs.kt.codeaction.CodeActionKt.codeActions(CodeAction.kt:23)\n\tat org.javacs.kt.KotlinTextDocumentService$codeAction$1.invoke(KotlinTextDocumentService.kt:95)\n\tat org.javacs.kt.KotlinTextDocumentService$codeAction$1.invoke(KotlinTextDocumentService.kt:93)\n\tat org.javacs.kt.util.AsyncExecutor.compute$lambda$2(AsyncExecutor.kt:19)\n\tat java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)\n\t... 3 more\n\n'
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 'async2 Internal error: java.lang.NullPointerException: Cannot invoke "org.eclipse.lsp4j.jsonrpc.messages.Either.getLeft()" because the return value of "org.eclipse.lsp4j.Diagnostic.getCode()" is null'
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 'java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "org.eclipse.lsp4j.jsonrpc.messages.Either.getLeft()" because the return value of "org.eclipse.lsp4j.Diagnostic.getCode()" is null'
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat java.base/java.lang.Thread.run(Thread.java:833)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 'Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.lsp4j.jsonrpc.messages.Either.getLeft()" because the return value of "org.eclipse.lsp4j.Diagnostic.getCode()" is null'
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat org.javacs.kt.codeaction.quickfix.AddMissingImportsQuickFix.getUnresolvedReferencesFromDiagnostics(AddMissingImportsQuickFix.kt:40)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat org.javacs.kt.codeaction.quickfix.AddMissingImportsQuickFix.compute(AddMissingImportsQuickFix.kt:18)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat org.javacs.kt.codeaction.CodeActionKt.getQuickFixes(CodeAction.kt:47)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat org.javacs.kt.codeaction.CodeActionKt.codeActions(CodeAction.kt:23)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat org.javacs.kt.KotlinTextDocumentService$codeAction$1.invoke(KotlinTextDocumentService.kt:95)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat org.javacs.kt.KotlinTextDocumentService$codeAction$1.invoke(KotlinTextDocumentService.kt:93)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat org.javacs.kt.util.AsyncExecutor.compute$lambda$2(AsyncExecutor.kt:19)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\tat java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)"
[ERROR][2023-06-22 23:41:24] ...lsp/handlers.lua:535 "\t... 3 more"
Java version
❯ java -version
openjdk version "17.0.7" 2023-04-18 LTS
OpenJDK Runtime Environment Corretto-17.0.7.7.1 (build 17.0.7+7-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.7.7.1 (build 17.0.7+7-LTS, mixed mode, sharing)