Skip to content

Message: An error occurred while handling textDocument/references request Code: -32001 #60005

Closed
@leaf-node

Description

@leaf-node

In VSCodium version 1.96.4.25026-el9 and VSCodium Insiders version 1.97.0.25026-el9 on OpenSUSE Tumbleweed, with Dart 3.6.1 installed by Flutter 3.27.3, I am no longer able to find references to Dart code that exists in other files. The LSP log in VSCodium shows the following after trying to search for a variable reference:

[Error - 6:16:14 PM] Request textDocument/references failed.
  Message: An error occurred while handling textDocument/references request
  Code: -32001 
[Error - 6:16:14 PM] An error occurred while handling textDocument/references request: Null check operator used on a null value
#0      Search._searchReferences_Local (package:analyzer/src/dart/analysis/search.dart:761:33)
#1      Search._searchReferences_Parameter (package:analyzer/src/dart/analysis/search.dart:801:26)
#2      Search.references (package:analyzer/src/dart/analysis/search.dart:386:14)
#3      SearchEngineImpl.searchReferences (package:analysis_server/src/services/search/search_engine_internal.dart:119:41)
#4      ElementReferencesComputer._findSingleElementReferences (package:analysis_server/src/search/element_references.dart:61:25)
#5      ElementReferencesComputer._findElementsReferences.<anonymous closure> (package:analysis_server/src/search/element_references.dart:52:18)
#6      OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:29)
#7      ElementReferencesComputer._findElementsReferences (package:analysis_server/src/search/element_references.dart:50:46)
<asynchronous suspension>
#8      OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)
<asynchronous suspension>
#9      ElementReferencesComputer.compute (package:analysis_server/src/search/element_references.dart:25:20)
<asynchronous suspension>
#10     OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)
<asynchronous suspension>
#11     ReferencesHandler._getReferences (package:analysis_server/src/lsp/handlers/handler_references.dart:84:19)
<asynchronous suspension>
#12     ErrorOrRecord2Extension.mapResults (package:analysis_server/src/lsp/error_or.dart:125:12)
<asynchronous suspension>
#13     OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)
<asynchronous suspension>
#14     ReferencesHandler.handle (package:analysis_server/src/lsp/handlers/handler_references.dart:42:12)
<asynchronous suspension>
#15     ServerStateMessageHandler.handleMessage (package:analysis_server/src/lsp/handlers/handlers.dart:452:11)
<asynchronous suspension>
#16     LspAnalysisServer._handleRequestMessage (package:analysis_server/src/lsp/lsp_analysis_server.dart:1068:18)
<asynchronous suspension>
#17     LspAnalysisServer.handleMessage.<anonymous closure>.<anonymous closure> (package:analysis_server/src/lsp/lsp_analysis_server.dart:509:15)
<asynchronous suspension>
#18     OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)
<asynchronous suspension>
#19     LspAnalysisServer.handleMessage.<anonymous closure> (package:analysis_server/src/lsp/lsp_analysis_server.dart:491:11)
<asynchronous suspension>

I see that the LSP is running in my process list:

andrew      5234  1.5  0.7 1580044 511784 ?      Sl   17:26   0:06 /home/andrew/.local/lib/flutter/bin/cache/dart-sdk/bin/dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.102.0

In the helix editor, version 25.1 (dabfb6ce), I see the following when I try to lookup a reference that exists outside of the file currently in view:

protocol error: ServerError(-32001): An error occurred while handling textDocument/references request

As an example, this error occurs when finding references (by right clicking) for allowClickAccept in the following project, file and line number: https://github.com/okcode-studio/open_alert_viewer/blob/main/lib/ui/settings/cubit/account_settings_cubit.dart#L157, but I'm seeing this in other files and for other references too.

I have tried clearing my ~/.dart*, ~/.pub-cache, ~/.cache and ran git clean -fxd in my Flutter checkout, but the problem persists.

This issue started probably within the last few hours or so, even before updating VSCodium from 1.95 to the most recent version, 1.96. Testing VSCodium Insiders did not resolve the issue either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions