How to find an error origin and what is the best way to do it?

  • Platform information:
    • Hardware: Celeron N5095/8G/512G
    • OS: Ubuntu 22.04.4 LTS
    • Java Runtime Environment: OpenJDK Runtime Environment 17.0.9+8-LTS
    • openHAB version: 4.1.2 (Build)
  • Issue of the topic: There is a runtime error in logs appearing about every minute:
17:14:30.036 [ERROR] [ist.antlr.ContentAssistContextFactory] - java.lang.RuntimeException: java.lang.NullPointerException                                                                                                                       
java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NullPointerException                                                                                                                                             
        at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?]                                                                                                                                                                   
        at java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[?:?]                                                                                                                                                                      
        at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.doCreateContexts(ContentAssistContextFactory.java:181) ~[?:?]                                                                                           
        at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.create(ContentAssistContextFactory.java:131) ~[?:?]                                                                                                     
        at org.eclipse.xtext.ide.server.contentassist.ContentAssistService.createProposals(ContentAssistService.java:106) ~[?:?]                                                                                                                
        at org.eclipse.xtext.ide.server.contentassist.ContentAssistService.createCompletionList(ContentAssistService.java:78) ~[?:?]                                                                                                            
        at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$26(LanguageServerImpl.java:581) ~[?:?]                                                                                                                                        
        at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:458) ~[?:?]                                                                                                                                               
        at org.eclipse.xtext.ide.server.LanguageServerImpl.completion(LanguageServerImpl.java:580) ~[?:?]                                                                                                                                       
        at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$25(LanguageServerImpl.java:566) ~[?:?]                                                                                                                                        
        at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$1(ReadRequest.java:66) ~[?:?]                                                                                                                                             
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]                                                                                                                                                        
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]                                                                                                                                                                       
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]                                                                                                                                                
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]                                                                                                                                                
        at java.lang.Thread.run(Thread.java:840) [?:?]                                                                                                                                                                                          
Caused by: java.lang.RuntimeException: java.lang.NullPointerException                                                                                                                                                                           
        at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:246) ~[?:?]                                                                                                  
        at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:237) ~[?:?]                                                                                                  
        at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:232) ~[?:?]                                                                                                  
        at org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser.getFollowElements(AbstractContentAssistParser.java:49) ~[?:?]                                                                                           
        at org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser.getFollowElements(AbstractContentAssistParser.java:1) ~[?:?]                                                                                            
        at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:264) ~[?:?]                                                                                                  
        at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.createContextsForLastCompleteNode(ContentAssistContextFactory.java:299) ~[?:?]                                                                          
        at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.handleLastCompleteNodeIsPartOfLookahead(ContentAssistContextFactory.java:220) ~[?:?]                                                                    
        at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory$3.call(ContentAssistContextFactory.java:172) ~[?:?]                                                                                                     
        at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory$3.call(ContentAssistContextFactory.java:1) ~[?:?]                                                                                                       
        ... 4 more                                                                                                                                                                                                                              
Caused by: java.lang.NullPointerException                                                                                                                                                                                                       
        at java.util.Objects.requireNonNull(Objects.java:209) ~[?:?]                                                                                                                                                                            
        at java.lang.Class.getMethod(Class.java:2219) ~[?:?]                                                                                                                                                                                    
        at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:169) ~[?:?]                                                                                                  
        at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:242) ~[?:?]                                                                                                  
        at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:237) ~[?:?]                                                                                                  
        at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:232) ~[?:?]                                                                                                  
        at org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser.getFollowElements(AbstractContentAssistParser.java:49) ~[?:?]                                                                                           
        at org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser.getFollowElements(AbstractContentAssistParser.java:1) ~[?:?]                                                                                            
        at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:264) ~[?:?]                                                                                                  
        at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.createContextsForLastCompleteNode(ContentAssistContextFactory.java:299) ~[?:?]                                                                          
        at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.handleLastCompleteNodeIsPartOfLookahead(ContentAssistContextFactory.java:220) ~[?:?]                                                                    
        at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory$3.call(ContentAssistContextFactory.java:172) ~[?:?]                                                                                                     
        at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory$3.call(ContentAssistContextFactory.java:1) ~[?:?]                                                                                                       
        ... 4 more 

By names of modules I can assume, that error somehow originates from openHAB built-in code editor, but nothing more…
Is there a way to more accurately determine why this error appears, determine a specific file and thus fix it?
I mean - to do this without loading senior Java and the entire openHAB architecture in the head? =)

This appears while rules are running or when editing rules through VSCode? I suppose it’s possible the MainUI script editor uses the LSP too but if it does I want aware of that.

The error indicates the later. Unfortunately this means the problem isn’t limited to .rules files and it can be coming from any file based config supported by the LSP (which is what does the intelisense and error checking in VSCode).

The good news is it’s certainly caused by some file you have open, most likely the one you have the cursor in for editing if it’s VSCode. Or it will be the script you have open in MainUI. This assumes it’s actually caused by your file and there isn’t something else going wrong with the LSP.

If it is something wrong with the LSP itself, the problem isn’t coming from your configs at all and it’s some sort of environment your it a bug.