Skip to content

Crash when requesting code completion #60463

New issue

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

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

Already on GitHub? # to your account

Open
scheglov opened this issue Apr 2, 2025 · 6 comments
Open

Crash when requesting code completion #60463

scheglov opened this issue Apr 2, 2025 · 6 comments
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-completion Issues with the analysis server's code completion feature P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@scheglov
Copy link
Contributor

scheglov commented Apr 2, 2025

## Dart analysis issue

Internal error: Failed to handle request: completion.getSuggestions2

## Version information

- Dart SDK 3.8.0-edge
- Dart IntelliJ 251.23774.109
- IntelliJ IDEA 2025.1 Beta
- Mac OS X 15.3.2

## Details

Internal error: Failed to handle request: completion.getSuggestions2
Invalid argument(s): Missing library: package:analyzer/src/dart/analysis/session.dart
Libraries: [dart:async, dart:collection, dart:convert, dart:core, dart:_internal, dart:math, dart:typed_data, package:path/src/path_exception.dart, package:path/path.dart, package:path/src/context.dart, 
package:analyzer/src/generated/element_walker.dart, package:analyzer/src/dart/analysis/file_tracker.dart, package:analyzer/src/dart/analysis/uri_converter.dart}][#0      LinkedElementFactory.removeLibraries (package:analyzer/src/summary2/linked_element_factory.dart:245:67)
#1      LibraryContext.remove (package:analyzer/src/dart/analysis/library_context.dart:360:20)
#2      AnalysisDriver._removePotentiallyAffectedLibraries (package:analyzer/src/dart/analysis/driver.dart:2211:22)
#3      AnalysisDriver._applyPendingFileChanges (package:analyzer/src/dart/analysis/driver.dart:1571:7)
#4      AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2626:16)
<asynchronous suspension>
]

#0      LinkedElementFactory.createLibraryElementForReading (package:analyzer/src/summary2/linked_element_factory.dart:132:7)
#1      LinkedElementFactory.elementOfReference (package:analyzer/src/summary2/linked_element_factory.dart:190:14)
#2      LinkedElementFactory.elementOfReference (package:analyzer/src/summary2/linked_element_factory.dart:194:25)
#3      LinkedElementFactory.elementOfReference (package:analyzer/src/summary2/linked_element_factory.dart:194:25)
#4      ResolutionReader._readRawElement (package:analyzer/src/summary2/bundle_reader.dart:2378:28)
#5      ResolutionReader.readElement (package:analyzer/src/summary2/bundle_reader.dart:1979:19)
#6      ResolutionReader.readType (package:analyzer/src/summary2/bundle_reader.dart:2104:21)
#7      ResolutionReader.readRequiredType (package:analyzer/src/summary2/bundle_reader.dart:2066:12)
#8      ElementLinkedData._readFormalParameters (package:analyzer/src/summary2/bundle_reader.dart:317:31)
#9      ConstructorElementLinkedData._read (package:analyzer/src/summary2/bundle_reader.dart:233:5)
#10     ElementLinkedData.read (package:analyzer/src/summary2/bundle_reader.dart:273:5)
#11     ExecutableElementImpl.metadata (package:analyzer/src/dart/element/element.dart:3732:17)
#12     ElementImpl._getMetadataFlags (package:analyzer/src/dart/element/element.dart:3221:25)
#13     ElementImpl.metadata2 (package:analyzer/src/dart/element/element.dart:3024:42)
#14     _extension#0.metadataOrEmpty (package:analyzer/src/dart/element/element.dart:12055:19)
#15     FragmentedAnnotatableElementMixin.metadata (package:analyzer/src/dart/element/element.dart:4979:30)
#16     FragmentedAnnotatableElementMixin.metadata2 (package:analyzer/src/dart/element/element.dart:4985:24)
#17     ElementExtensions.hasOrInheritsDeprecated (package:analysis_server/src/utilities/extensions/element.dart:46:23)
#18     FeatureComputer.hasDeprecatedFeature (package:analysis_server/src/services/completion/dart/feature_computer.dart:357:20)
#19     RelevanceComputer.computeTopLevelRelevance (package:analysis_server/src/services/completion/dart/relevance_computer.dart:356:41)
#20     RelevanceComputer._computeConstructorRelevance (package:analysis_server/src/services/completion/dart/relevance_computer.dart:431:12)
#21     RelevanceComputer.computeRelevance (package:analysis_server/src/services/completion/dart/relevance_computer.dart:118:16)
#22     SuggestionBuilderExtension.suggestFromCandidate (package:analysis_server/src/services/completion/dart/candidate_suggestion.dart:1271:39)
#23     SuggestionBuilderExtension.suggestFromCandidates (package:analysis_server/src/services/completion/dart/candidate_suggestion.dart:1538:13)
<asynchronous suspension>
#24     DartCompletionManager.computeSuggestions (package:analysis_server/src/services/completion/dart/completion_manager.dart:214:5)
<asynchronous suspension>
#25     CompletionGetSuggestions2Handler.computeSuggestions.<anonymous closure> (package:analysis_server/src/handler/legacy/completion_get_suggestions2.dart:61:9)
<asynchronous suspension>
#26     OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)
<asynchronous suspension>
#27     CompletionGetSuggestions2Handler.computeSuggestions (package:analysis_server/src/handler/legacy/completion_get_suggestions2.dart:54:5)
<asynchronous suspension>
#28     CompletionGetSuggestions2Handler.handle.<anonymous closure> (package:analysis_server/src/handler/legacy/completion_get_suggestions2.dart:198:30)
<asynchronous suspension>
#29     OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)
<asynchronous suspension>
#30     CompletionGetSuggestions2Handler.handle (package:analysis_server/src/handler/legacy/completion_get_suggestions2.dart:141:5)
<asynchronous suspension>
#31     LegacyAnalysisServer.handleRequest.<anonymous closure>.<anonymous closure> (package:analysis_server/src/legacy_analysis_server.dart:643:13)
<asynchronous suspension>
#32     OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)
<asynchronous suspension>
#33     LegacyAnalysisServer.handleRequest.<anonymous closure> (package:analysis_server/src/legacy_analysis_server.dart:623:9)
<asynchronous suspension>

null


## Debug log

1743617936881 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/remove_empty_else_test.dart","errors":...
1743617936890 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart","errors":[]...
1743617936895 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/remove_type_arguments_test.dart","erro...
1743617936899 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/remove_late_test.dart","errors":[]}}
1743617936906 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/import_library_sdk_test.dart","errors"...
1743617936911 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/insert_on_keyword_test.dart","errors":...
1743617936915 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/replace_final_with_const_test.dart","e...
1743617936919 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/convert_to_raw_string_test.dart","erro...
1743617936927 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/replace_container_with_colored_box_tes...
1743617936931 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/convert_to_cascade_test.dart","errors"...
1743617936935 => {"id":"3361","method":"analysis.updateContent","params":{"files":{"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer/lib/src/fine/manifest_item.dart":{"type":"add","content"...
1743617936935 => {"id":"3362","method":"completion.getSuggestions2","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer/lib/src/fine/manifest_item.dart","offset":13975,"maxRe...
1743617936937 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/use_different_division_operator_test.d...
1743617936943 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart","errors":[...
1743617936943 <= {"id":"3361","result":{}}
1743617937012 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer/lib/src/fine/manifest_item.dart","errors":[{"severity":"ERROR","type":"COMPILE...
1743617937014 <= {"event":"analysis.highlights","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer/lib/src/fine/manifest_item.dart","regions":[{"type":"DIRECTIVE","offset":2...
1743617937020 <= {"event":"analysis.navigation","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer/lib/src/fine/manifest_item.dart","regions":[{"offset":223,"length":48,"tar...
1743617937024 <= {"event":"analysis.outline","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer/lib/src/fine/manifest_item.dart","kind":"LIBRARY","outline":{"element":{"kind...
1743617937026 <= {"event":"analysis.overrides","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer/lib/src/fine/manifest_item.dart","overrides":[{"offset":2248,"length":5,"su...
1743617937054 <= {"id":"3362","result":{"replacementOffset":13974,"replacementLength":1,"suggestions":[{"kind":"IDENTIFIER","relevance":601,"completion":"element","selectionOffset":7,"selectionLength"...
1743617937054 => {"id":"3363","method":"completion.getSuggestions2","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer/lib/src/fine/manifest_item.dart","offset":13975,"maxRe...
1743617937080 => {"id":"3364","method":"analysis.updateContent","params":{"files":{"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer/lib/src/fine/manifest_item.dart":{"type":"add","content"...
1743617937080 => {"id":"3365","method":"completion.getSuggestions2","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer/lib/src/fine/manifest_item.dart","offset":13976,"maxRe...
1743617937092 <= {"event":"analysis.errors","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/src/services/correction/fix/remove_await_test.dart","errors":[]}}
1743617937097 <= {"id":"3364","result":{}}
1743617937166 => {"id":"3366","method":"analysis.updateContent","params":{"files":{"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer/lib/src/fine/manifest_item.dart":{"type":"add","content"...
1743617937166 => {"id":"3367","method":"completion.getSuggestions2","params":{"file":"file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer/lib/src/fine/manifest_item.dart","offset":13977,"maxRe...
1743617937176 <= {"id":"3366","result":{}}
1743617937207 <= {"event":"server.error","params":{"isFatal":true,"message":"Internal error: Failed to handle request: completion.getSuggestions2\nInvalid argument(s): Missing library: package:analyze...

@scheglov scheglov added the area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. label Apr 2, 2025
@scheglov
Copy link
Contributor Author

scheglov commented Apr 2, 2025

I suspect that there was analysis.updateContent executed while completion.getSuggestions2 was running.
So, it unloaded some libraries.

@scheglov
Copy link
Contributor Author

scheglov commented Apr 2, 2025

I get many of such crashes reported in my IntelliJ.

@bwilkerson bwilkerson added devexp-completion Issues with the analysis server's code completion feature P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Apr 2, 2025
@bwilkerson
Copy link
Member

How long have you been seeing this issue?

@scheglov
Copy link
Contributor Author

scheglov commented Apr 2, 2025

In general - long.
Then it stopped.
And it started again a day or two ago.

@bwilkerson
Copy link
Member

That corresponds to the time that https://dart-review.git.corp.google.com/c/sdk/+/419340 landed, assuming that you built your local SDK after about 9:11 am.

@scheglov
Copy link
Contributor Author

scheglov commented Apr 2, 2025

Yes, I think you are right, it started again after this CL.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-completion Issues with the analysis server's code completion feature P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants