sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Analyzer crash report: Invalid argument(s): Missing library

Open srawlins opened this issue 1 year ago • 1 comments

ArgumentError:

Invalid argument(s): Missing library: package:xyz
Libraries: [dart:async, dart:collection, dart:convert, dart:core, dart:_internal, dart:math, dart:typed_data, package:abc
Root children: [dart:async, dart:collection, dart:convert, dart:core, dart:_internal, dart:math, dart:typed_data, package:abc
Readers: [dart:async, dart:collection, dart:convert, dart:core, dart:_internal, dart:math, dart:typed_data, package:abc
Log: [load][targetLibrary: package:xyz
[load][targetLibrary: package:xyz
[load][targetLibrary: <path>
[removeLibraries][uriSet: {package:xyz
#1      LibraryContext.remove (package:analyzer<path>
#2      AnalysisDriver._removePotentiallyAffectedLibraries (package:analyzer<path>
#3      AnalysisDriver._applyPendingFileChanges (package:analyzer<path>
#4      <filename> (package:analyzer<path>
<asynchronous suspension>
]
[load][targetLibrary: package:xyz
[load][targetLibrary: package:xyz
[load][targetLibrary: package:xyz
[load][targetLibrary: package:xyz
[load][targetLibrary: package:xyz
[load][targetLibrary: package:xyz

Stack trace:

#1      LibraryContext.remove (package:analyzer<path>
#2      AnalysisDriver._removePotentiallyAffectedLibraries (package:analyzer<path>
#3      AnalysisDriver._applyPendingFileChanges (package:analyzer<path>
#4      
at LinkedElementFactory.createLibraryElementForReading	(linked_element_factory.dart:153)
at LinkedElementFactory.elementOfReference	(linked_element_factory.dart:212)
at LinkedElementFactory.libraryOfUri	(linked_element_factory.dart:241)
at LinkedElementFactory.libraryOfUri2	(linked_element_factory.dart:245)
at ResolutionReader.libraryOfUri	(bundle_reader.dart:1988)
at LibraryElementLinkedData._readLibraryOrAugmentation	(bundle_reader.dart:628)
at LibraryElementLinkedData._read	(bundle_reader.dart:577)
at ElementLinkedData.read	(bundle_reader.dart:254)
at LibraryElementLinkedData.read	(bundle_reader.dart:561)
at LibraryElementImpl.exportNamespace	(element.dart:4235)
at LibraryElementExtensions.exportedExtensions	(element.dart:61)
at _ImportLibraryContainingExtension.compute	(import_library.dart:484)
at FixProcessor._addFromProducers.compute	(fix_processor.dart:111)
at FixProcessor._addFromProducers	(fix_processor.dart:147)
at <asynchronous gap>	(async)
at FixProcessor.compute	(fix_processor.dart:76)
at <asynchronous gap>	(async)
at computeFixes	(fix_internal.dart:1719)
at <asynchronous gap>	(async)
at DartCodeActionsProducer.getFixActions	(dart.dart:178)
at <asynchronous gap>	(async)
at OperationPerformanceImpl.runAsync	(operation_performance.dart:174)
at <asynchronous gap>	(async)
at CodeActionHandler.handle.<fn>.<fn>	(handler_code_actions.dart:227)
at <asynchronous gap>	(async)
at ErrorOrRecord2Extension.mapResults	(error_or.dart:125)
at <asynchronous gap>	(async)
at ErrorOr.mapResult	(error_or.dart:94)
at <asynchronous gap>	(async)
at ServerStateMessageHandler.handleMessage	(handlers.dart:397)
at <asynchronous gap>	(async)
at LspAnalysisServer._handleRequestMessage	(lsp_analysis_server.dart:1006)
at <asynchronous gap>	(async)
at LspAnalysisServer.handleMessage.<fn>.<fn>	(lsp_analysis_server.dart:461)
at <asynchronous gap>	(async)
at OperationPerformanceImpl.runAsync	(operation_performance.dart:174)
at <asynchronous gap>	(async)
at LspAnalysisServer.handleMessage.<fn>	(lsp_analysis_server.dart:444)

Seen in, at least, 3.5.0-234.0.dev, 3.5.0-236.0.dev, 3.5.0-238.0.dev, 3.5.0-250.0.dev, 3.5.0-254.0.dev

srawlins avatar Jun 14 '24 15:06 srawlins

@scheglov

bwilkerson avatar Jun 24 '24 14:06 bwilkerson

Still seen in 3.5.0-323.0.dev

keertip avatar Jul 10 '24 16:07 keertip

My long time hypothesis is that this is caused by attempt to run multiple async operations in parallel. Probably here quick fix, file system change event, and the analysis driver. We need to run them sequentially. AFAIK now there is a plan to do this.

scheglov avatar Jul 10 '24 19:07 scheglov