dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.28k stars 1.58k forks source link

Internal error: Bad state: Expected existing element #56922

Open ChaserVasya opened 1 month ago

ChaserVasya commented 1 month ago

This error is threw very often with different files

Dart analysis issue

Internal error: Bad state: Expected existing element: root::package:CONFIDENTIAL_INFO/domain/models/schedule/schedule_calendar.dart::@unit::package:CONFIDENTIAL_INFO/domain/models/schedule/schedule_calendar.dart

Version information

Details

Internal error: Bad state: Expected existing element: root::package:CONFIDENTIAL_INFO/domain/models/schedule/schedule_calendar.dart::@unit::package:CONFIDENTIAL_INFO/domain/models/schedule/schedule_calendar.dart

0 LinkedElementFactory.elementOfReference (package:analyzer/src/summary2/linked_element_factory.dart:225:7)

1 LinkedElementFactory.elementOfReference (package:analyzer/src/summary2/linked_element_factory.dart:216:25)

2 ResolutionReader._readRawElement (package:analyzer/src/summary2/bundle_reader.dart:2502:28)

3 ResolutionReader.readElement (package:analyzer/src/summary2/bundle_reader.dart:2008:19)

4 ResolutionReader.readType (package:analyzer/src/summary2/bundle_reader.dart:2149:21)

5 ResolutionReader.readRequiredType (package:analyzer/src/summary2/bundle_reader.dart:2111:12)

6 ResolutionReader._readRecordType. (package:analyzer/src/summary2/bundle_reader.dart:2515:15)

7 SummaryDataReader.readTypedList. (package:analyzer/src/summary2/data_reader.dart:144:18)

8 new _List.generate (dart:core-patch/array.dart:113:28)

9 SummaryDataReader.readTypedList (package:analyzer/src/summary2/data_reader.dart:143:12)

10 ResolutionReader.readTypedList (package:analyzer/src/summary2/bundle_reader.dart:2188:20)

11 ResolutionReader._readRecordType (package:analyzer/src/summary2/bundle_reader.dart:2512:23)

12 ResolutionReader.readType (package:analyzer/src/summary2/bundle_reader.dart:2169:18)

13 ResolutionReader.readRequiredType (package:analyzer/src/summary2/bundle_reader.dart:2111:12)

14 ResolutionReader._readTypeList. (package:analyzer/src/summary2/bundle_reader.dart:2535:14)

15 SummaryDataReader.readTypedList. (package:analyzer/src/summary2/data_reader.dart:144:18)

16 new _List.generate (dart:core-patch/array.dart:113:28)

17 SummaryDataReader.readTypedList (package:analyzer/src/summary2/data_reader.dart:143:12)

18 ResolutionReader.readTypedList (package:analyzer/src/summary2/bundle_reader.dart:2188:20)

19 ResolutionReader._readTypeList (package:analyzer/src/summary2/bundle_reader.dart:2534:12)

20 ResolutionReader.readType (package:analyzer/src/summary2/bundle_reader.dart:2140:27)

21 ResolutionReader.readRequiredType (package:analyzer/src/summary2/bundle_reader.dart:2111:12)

22 ExtensionElementLinkedData._read (package:analyzer/src/summary2/bundle_reader.dart:399:33)

23 ElementLinkedData.read (package:analyzer/src/summary2/bundle_reader.dart:257:5)

24 ExtensionElementImpl.augmented (package:analyzer/src/dart/element/element.dart:2989:17)

25 ExtensionsExtensions.havingMemberWithBaseName (package:analyzer/src/dart/resolver/applicable_extensions.dart:146:37)

26 _ImportLibraryContainingExtension.compute (package:analysis_server/src/services/correction/dart/import_library.dart:494:10)

27 FixProcessor._addFromProducers.compute (package:analysis_server/src/services/correction/fix_processor.dart:111:24)

28 FixProcessor._addFromProducers (package:analysis_server/src/services/correction/fix_processor.dart:147:17)

#29 FixProcessor.compute (package:analysis_server/src/services/correction/fix_processor.dart:76:5) #30 computeFixes (package:analysis_server/src/services/correction/fix_internal.dart:1812:8) #31 EditGetFixesHandler._computeDartFixes (package:analysis_server/src/handler/legacy/edit_get_fixes.dart:192:21) #32 EditGetFixesHandler.handle (package:analysis_server/src/handler/legacy/edit_get_fixes.dart:76:26) #33 LegacyAnalysisServer.handleRequest.. (package:analysis_server/src/legacy_analysis_server.dart:576:11) #34 OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14) #35 LegacyAnalysisServer.handleRequest. (package:analysis_server/src/legacy_analysis_server.dart:557:7) ``` null ``` ## Debug log ``` 1729391019037 => {"id":"798","method":"edit.getFixes","params":{"file":"file:///Users/MY_NAME/Documents/projects/CONFIDENTIAL_INFO/lib/ui/screens/client_creating/ui/widgets/tiles/... 1729391019038 <= {"event":"analysis.navigation","params":{"file":"file:///Users/MY_NAME/Documents/projects/CONFIDENTIAL_INFO/lib/ui/screens/client_creating/ui/widgets/tiles/base_t... 1729391019039 <= {"event":"analysis.closingLabels","params":{"file":"file:///Users/MY_NAME/Documents/projects/CONFIDENTIAL_INFO/lib/ui/screens/client_creating/ui/widgets/tiles/bas... 1729391019044 <= {"event":"analysis.outline","params":{"file":"file:///Users/MY_NAME/Documents/projects/CONFIDENTIAL_INFO/lib/ui/screens/client_creating/ui/widgets/tiles/base_tile... 1729391019046 <= {"event":"analysis.overrides","params":{"file":"file:///Users/MY_NAME/Documents/projects/CONFIDENTIAL_INFO/lib/ui/screens/client_creating/ui/widgets/tiles/base_ti... 1729391019058 => {"id":"799","method":"edit.getFixes","params":{"file":"file:///Users/MY_NAME/Documents/projects/CONFIDENTIAL_INFO/lib/ui/screens/client_creating/ui/widgets/tiles/... 1729391019059 <= {"event":"flutter.outline","params":{"file":"file:///Users/MY_NAME/Documents/projects/CONFIDENTIAL_INFO/lib/ui/screens/client_creating/ui/widgets/tiles/base_tile.... 1729391019065 <= {"id":"798","result":{"fixes":[{"error":{"severity":"ERROR","type":"SYNTACTIC_ERROR","location":{"file":"file:///Users/MY_NAME/Documents/projects/CONFIDENTIAL_INFO... 1729391019065 <= {"id":"799","result":{"fixes":[{"error":{"severity":"ERROR","type":"SYNTACTIC_ERROR","location":{"file":"file:///Users/MY_NAME/Documents/projects/CONFIDENTIAL_INFO... 1729391019070 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}} 1729391019070 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}} 1729391019075 => {"id":"800","method":"edit.getFixes","params":{"file":"file:///Users/MY_NAME/Documents/projects/CONFIDENTIAL_INFO/lib/ui/screens/client_creating/ui/widgets/tiles/... 1729391019080 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}} 1729391019080 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}} 1729391019092 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}} 1729391019093 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}} 1729391019094 <= {"id":"800","result":{"fixes":[{"error":{"severity":"ERROR","type":"SYNTACTIC_ERROR","location":{"file":"file:///Users/MY_NAME/Documents/projects/CONFIDENTIAL_INFO... 1729391019111 <= {"event":"analysis.implemented","params":{"file":"file:///Users/MY_NAME/Documents/projects/CONFIDENTIAL_INFO/lib/ui/screens/client_creating/ui/widgets/tiles/base_... 1729391019114 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}} 1729391019114 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}} 1729391019119 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}} 1729391019119 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}} 1729391019123 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}} 1729391019123 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}} 1729391019126 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}} 1729391019126 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}} 1729391019130 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}} 1729391019130 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}} 1729391019137 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}} 1729391019145 <= {"event":"server.error","params":{"isFatal":false,"message":"Internal error: Bad state: Expected existing element: root::package:CONFIDENTIAL_INFO/domain/models/schedule/schedule_calendar.... ```
dart-github-bot commented 1 month ago

Summary: The user is experiencing an "Internal error: Bad state: Expected existing element" error during Dart analysis. The error occurs frequently with different files and appears to be related to the analysis of the schedule_calendar.dart file.