Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Dart analysis issue. Missing library: dart:async #56798

Open
mjablecnik opened this issue Sep 27, 2024 · 6 comments
Open

Dart analysis issue. Missing library: dart:async #56798

mjablecnik opened this issue Sep 27, 2024 · 6 comments
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. 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

@mjablecnik
Copy link

Hello, I have some issue with Dart analysis.
Can you say me how can I fix it?
It is appeared in this my project: https://github.com/mjablecnik/startup_project
Restart, clean cache, update/upgrade packages or IDE doesn't work..

Here is my log from Dart analysis:

Dart analysis issue

Internal error: Invalid argument(s): Missing library: dart:async

Version information

  • Dart SDK 3.5.3
  • Dart IntelliJ 241.18968.26
  • Android Studio Koala Feature Drop | 2024.1.2 Patch 1
  • Mac OS X 14.1

Details

Internal error: Invalid argument(s): Missing library: dart:async
Libraries: [dart:core]
Root children: [dart:core, dart:async]
Readers: []
Log: [removeLibraries][uriSet: {}][#0 LinkedElementFactory.removeLibraries (package:analyzer/src/summary2/linked_element_factory.dart:262:67)
#1 LibraryContext.remove (package:analyzer/src/dart/analysis/library_context.dart:315:20)
#2 AnalysisDriver._removePotentiallyAffectedLibraries (package:analyzer/src/dart/analysis/driver.dart:2037:22)
#3 AnalysisDriver._applyPendingFileChanges (package:analyzer/src/dart/analysis/driver.dart:1510:7)
#4 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2411:16)

]
[removeLibraries][uriSet: {}][#0 LinkedElementFactory.removeLibraries (package:analyzer/src/summary2/linked_element_factory.dart:262:67)
#1 LibraryContext.remove (package:analyzer/src/dart/analysis/library_context.dart:315:20)
#2 AnalysisDriver._removePotentiallyAffectedLibraries (package:analyzer/src/dart/analysis/driver.dart:2037:22)
#3 AnalysisDriver._applyPendingFileChanges (package:analyzer/src/dart/analysis/driver.dart:1510:7)
#4 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2411:16)

]
[removeLibraries][uriSet: {}][#0 LinkedElementFactory.removeLibraries (package:analyzer/src/summary2/linked_element_factory.dart:262:67)
#1 LibraryContext.remove (package:analyzer/src/dart/analysis/library_context.dart:315:20)
#2 AnalysisDriver._removePotentiallyAffectedLibraries (package:analyzer/src/dart/analysis/driver.dart:2037:22)
#3 AnalysisDriver._applyPendingFileChanges (package:analyzer/src/dart/analysis/driver.dart:1510:7)
#4 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2411:16)

]
[removeLibraries][uriSet: {}][#0 LinkedElementFactory.removeLibraries (package:analyzer/src/summary2/linked_element_factory.dart:262:67)
#1 LibraryContext.remove (package:analyzer/src/dart/analysis/library_context.dart:315:20)
#2 AnalysisDriver._removePotentiallyAffectedLibraries (package:analyzer/src/dart/analysis/driver.dart:2037:22)
#3 AnalysisDriver._applyPendingFileChanges (package:analyzer/src/dart/analysis/driver.dart:1510:7)
#4 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2411:16)

]
[removeLibraries][uriSet: {}][#0 LinkedElementFactory.removeLibraries (package:analyzer/src/summary2/linked_element_factory.dart:262:67)
#1 LibraryContext.remove (package:analyzer/src/dart/analysis/library_context.dart:315:20)
#2 AnalysisDriver._removePotentiallyAffectedLibraries (package:analyzer/src/dart/analysis/driver.dart:2037:22)
#3 AnalysisDriver._applyPendingFileChanges (package:analyzer/src/dart/analysis/driver.dart:1510:7)
#4 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2411:16)

]
[removeLibraries][uriSet: {}][#0 LinkedElementFactory.removeLibraries (package:analyzer/src/summary2/linked_element_factory.dart:262:67)
#1 LibraryContext.remove (package:analyzer/src/dart/analysis/library_context.dart:315:20)
#2 AnalysisDriver._removePotentiallyAffectedLibraries (package:analyzer/src/dart/analysis/driver.dart:2037:22)
#3 AnalysisDriver._applyPendingFileChanges (package:analyzer/src/dart/analysis/driver.dart:1510:7)
#4 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2411:16)

]
[removeLibraries][uriSet: {}][#0 LinkedElementFactory.removeLibraries (package:analyzer/src/summary2/linked_element_factory.dart:262:67)
#1 LibraryContext.remove (package:analyzer/src/dart/analysis/library_context.dart:315:20)
#2 AnalysisDriver._removePotentiallyAffectedLibraries (package:analyzer/src/dart/analysis/driver.dart:2037:22)
#3 AnalysisDriver._applyPendingFileChanges (package:analyzer/src/dart/analysis/driver.dart:1510:7)
#4 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2411:16)

]
[removeLibraries][uriSet: {}][#0 LinkedElementFactory.removeLibraries (package:analyzer/src/summary2/linked_element_factory.dart:262:67)
#1 LibraryContext.remove (package:analyzer/src/dart/analysis/library_context.dart:315:20)
#2 AnalysisDriver._removePotentiallyAffectedLibraries (package:analyzer/src/dart/analysis/driver.dart:2037:22)
#3 AnalysisDriver._applyPendingFileChanges (package:analyzer/src/dart/analysis/driver.dart:1510:7)
#4 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2411:16)

]
[removeLibraries][uriSet: {}][#0 LinkedElementFactory.removeLibraries (package:analyzer/src/summary2/linked_element_factory.dart:262:67)
#1 LibraryContext.remove (package:analyzer/src/dart/analysis/library_context.dart:315:20)
#2 AnalysisDriver._removePotentiallyAffectedLibraries (package:analyzer/src/dart/analysis/driver.dart:2037:22)
#3 AnalysisDriver._applyPendingFileChanges (package:analyzer/src/dart/analysis/driver.dart:1510:7)
#4 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2411:16)

]
[load][targetLibrary: file:///Users/martin/Projects/Templates/startup_project/apps/flutter_project_template/layers/project_repository/test/http_client_test.dart = /Users/martin/Projects/Templates/startup_project/apps/flutter_project_template/layers/project_repository/test/http_client_test.dart]

#0 LinkedElementFactory.createLibraryElementForReading (package:analyzer/src/summary2/linked_element_factory.dart:153:7)
#1 LinkedElementFactory.elementOfReference (package:analyzer/src/summary2/linked_element_factory.dart:212:14)
#2 LinkedElementFactory.libraryOfUri (package:analyzer/src/summary2/linked_element_factory.dart:241:12)
#3 LinkedElementFactory.libraryOfUri2 (package:analyzer/src/summary2/linked_element_factory.dart:245:19)
#4 LinkedElementFactory.dartAsyncElement (package:analyzer/src/summary2/linked_element_factory.dart:52:12)
#5 Linker._createTypeSystem (package:analyzer/src/summary2/link.dart:349:22)
#6 Linker._buildOutlines (package:analyzer/src/summary2/link.dart:247:5)

#7 Linker.link. (package:analyzer/src/summary2/link.dart:123:7)

#8 OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)

#9 Linker.link (package:analyzer/src/summary2/link.dart:122:5)

#10 link (package:analyzer/src/summary2/link.dart:41:3)

#11 LibraryContext.load.loadBundle. (package:analyzer/src/dart/analysis/library_context.dart:211:22)

#12 OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)

#13 LibraryContext.load.loadBundle (package:analyzer/src/dart/analysis/library_context.dart:208:24)

#14 LibraryContext.load.loadBundle (package:analyzer/src/dart/analysis/library_context.dart:158:9)

#15 LibraryContext.load.loadBundle (package:analyzer/src/dart/analysis/library_context.dart:158:9)

#16 LibraryContext.load. (package:analyzer/src/dart/analysis/library_context.dart:296:7)

#17 PerformanceLog.runAsync (package:analyzer/src/dart/analysis/performance_logger.dart:50:14)

#18 LibraryContext.load (package:analyzer/src/dart/analysis/library_context.dart:287:5)

#19 AnalysisDriver._produceErrors (package:analyzer/src/dart/analysis/driver.dart:1976:5)

#20 AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:1251:7)

#21 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2455:7)

#0      LibraryContext._throwLibraryCycleLinkException (package:analyzer/src/dart/analysis/library_context.dart:425:5)
#1      LibraryContext.load.loadBundle (package:analyzer/src/dart/analysis/library_context.dart:222:11)
<asynchronous suspension>
#2      LibraryContext.load.loadBundle (package:analyzer/src/dart/analysis/library_context.dart:158:9)
<asynchronous suspension>
#3      LibraryContext.load.loadBundle (package:analyzer/src/dart/analysis/library_context.dart:158:9)
<asynchronous suspension>
#4      LibraryContext.load.<anonymous closure> (package:analyzer/src/dart/analysis/library_context.dart:296:7)
<asynchronous suspension>
#5      PerformanceLog.runAsync (package:analyzer/src/dart/analysis/performance_logger.dart:50:14)
<asynchronous suspension>
#6      LibraryContext.load (package:analyzer/src/dart/analysis/library_context.dart:287:5)
<asynchronous suspension>
#7      AnalysisDriver._produceErrors (package:analyzer/src/dart/analysis/driver.dart:1976:5)
<asynchronous suspension>
#8      AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:1251:7)
<asynchronous suspension>
#9      AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2455:7)
<asynchronous suspension>

Debug log

1727443745592 <= {"id":"7"}
1727443745843 <= {"event":"analysis.errors","params":{"file":"file:///Users/martin/Projects/Templates/startup_project/apps/flutter_project_template/layers/project_repository/pubspec.yaml","errors":[{"...
1727443745849 <= {"event":"analysis.errors","params":{"file":"file:///Users/martin/Projects/Templates/startup_project/apps/flutter_project_template/layers/project_repository/analysis_options.yaml","er...
1727443745849 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1727443746021 <= {"event":"server.error","params":{"isFatal":false,"message":"Internal error: Invalid argument(s): Missing library: dart:async\nLibraries: [dart:core]\nRoot children: [dart:core, dart:...
1727443746824 => {"id":"8","method":"analysis.getHover","params":{"file":"file:///Users/martin/Projects/Templates/startup_project/apps/flutter_project_template/layers/project_repository/test/http_clie...
1727443747855 => {"id":"9","method":"server.shutdown","clientRequestTime":1727443747854}
1727443757542 started analysis server:
  /Users/martin/fvm/versions/3.24.3/bin/cache/dart-sdk/bin/dart language-server --client-id=Android-Studio --client-version=AI-241.19072.14 --protocol=analyzer
1727443757767 <= {"event":"server.connected","params":{"version":"1.38.0","pid":30445}}
1727443757777 <= {"id":"0","result":{"version":"1.38.0"}}
1727443757777 => {"id":"1","method":"server.setSubscriptions","params":{"subscriptions":["STATUS"]},"clientRequestTime":1727443757551}
1727443757778 => {"id":"2","method":"analysis.updateOptions","params":{"options":{"enableAsync":true,"enableDeferredLoading":true,"enableEnums":true,"enableNullAwareOperators":true,"generateDart2jsHin...
1727443757778 => {"id":"3","method":"server.setClientCapabilities","params":{"requests":["openUrlRequest","showMessageRequest"],"supportsUris":true},"clientRequestTime":1727443757552}
1727443757778 => {"id":"4","method":"analysis.setAnalysisRoots","params":{"included":["file:///Users/martin/Projects/Templates/startup_project/apps/flutter_project_template/layers/project_repository"]...
1727443757778 => {"id":"5","method":"analysis.setPriorityFiles","params":{"files":["file:///Users/martin/Projects/Templates/startup_project/apps/flutter_project_template/layers/project_repository/test...
1727443757778 => {"id":"6","method":"analysis.setSubscriptions","params":{"subscriptions":{"CLOSING_LABELS":["file:///Users/martin/Projects/Templates/startup_project/apps/flutter_project_template/laye...
1727443757778 => {"id":"7","method":"edit.getAssists","params":{"file":"file:///Users/martin/Projects/Templates/startup_project/apps/flutter_project_template/layers/project_repository/test/mock_data.d...
1727443757778 => {"id":"8","method":"flutter.setSubscriptions","params":{"subscriptions":{"OUTLINE":["file:///Users/martin/Projects/Templates/startup_project/apps/flutter_project_template/layers/proje...
1727443757780 <= {"id":"1"}
1727443757782 <= {"id":"2"}
1727443757784 <= {"id":"3"}
1727443757787 <= {"id":"5"}
1727443757790 <= {"id":"6"}
1727443757793 <= {"id":"8"}
1727443757795 <= {"id":"7","result":{"assists":[]}}
1727443758053 <= {"event":"analysis.errors","params":{"file":"file:///Users/martin/Projects/Templates/startup_project/apps/flutter_project_template/layers/project_repository/pubspec.yaml","errors":[{"...
1727443758063 <= {"event":"analysis.errors","params":{"file":"file:///Users/martin/Projects/Templates/startup_project/apps/flutter_project_template/layers/project_repository/analysis_options.yaml","er...
1727443758063 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1727443758658 <= {"event":"server.error","params":{"isFatal":false,"message":"Internal error: Invalid argument(s): Missing library: dart:async\nLibraries: [dart:core]\nRoot children: [dart:core, dart:...


@dart-github-bot
Copy link
Collaborator

Summary: The user is experiencing an error during Dart analysis, where the "dart:async" library is missing. The error occurs despite restarting, cleaning the cache, updating packages, and upgrading the IDE. The user has provided their project repository, version information, and a detailed log of the error.

@dart-github-bot dart-github-bot added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Sep 27, 2024
@mraleph
Copy link
Member

mraleph commented Sep 27, 2024

Try close IDE, purge analysis driver cache by doing mv ~/.dartServer ~/.dartServer.bak and start IDE again.

If that helps then something is wrong with analysis driver cache got somehow corrupted and might be of interest to analyzer team.

@mjablecnik
Copy link
Author

@mraleph Your advice didn't work, but I discovered that downgrading to Flutter version 3.22.0 solved the issue.

@mjablecnik
Copy link
Author

Version where it works is:

martin at Martins-MacBook-Air startup_project >>> flutter --version
Flutter 3.22.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5dcb86f68f (5 months ago) • 2024-05-09 07:39:20 -0500
Engine • revision f6344b75dc
Tools • Dart 3.4.0 • DevTools 2.34.3

@mjablecnik
Copy link
Author

I created a specific branch in my project: https://github.com/mjablecnik/startup_project/tree/dart-analysis-issue where I had the problem if you will need it for test.

@lrhn lrhn removed the triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. label Sep 28, 2024
@bwilkerson
Copy link
Member

@scheglov

@bwilkerson bwilkerson added the P2 A bug or feature request we're likely to work on label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. 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

5 participants