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

Error while processing the analysis.setAnalysisRoots request #56429

Closed
lucasjinreal opened this issue Aug 10, 2024 · 7 comments
Closed

Error while processing the analysis.setAnalysisRoots request #56429

lucasjinreal opened this issue Aug 10, 2024 · 7 comments
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@lucasjinreal
Copy link

Analyzing neso_flutter...
An unexpected error was encountered by the Analysis Server.
Please file an issue at https://github.com/dart-lang/sdk/issues/new/choose with the following details:

Internal error: Failed to handle request: analysis.setAnalysisRoots
type 'Null' is not a subtype of type 'Object' in type cast
#0      YamlNodeExtension.valueOrThrow (package:analyzer/src/util/yaml.dart:147:36)
#1      _LintConfig.asString (package:analyzer/src/lint/config.dart:93:47)
#2      _LintConfig._parseYaml.<anonymous closure> (package:analyzer/src/lint/config.dart:136:29)
#3      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
#4      MapView.forEach (dart:collection/maps.dart:347:10)
#5      _LintConfig._parseYaml (package:analyzer/src/lint/config.dart:117:16)
#6      new LintConfig.parseMap (package:analyzer/src/lint/config.dart:38:62)
#7      parseConfig (package:analyzer/src/lint/config.dart:15:25)
#8      AnalysisOptionsImplExtensions.applyOptions (package:analyzer/src/analysis_options/apply_options.dart:229:18)
#9      ContextBuilderImpl._createOptionsMap (package:analyzer/src/dart/analysis/context_builder.dart:210:15)
#10     ContextBuilderImpl.createContext (package:analyzer/src/dart/analysis/context_builder.dart:135:15)
#11     new AnalysisContextCollectionImpl (package:analyzer/src/dart/analysis/analysis_context_collection.dart:108:36)
#12     ContextManagerImpl._createAnalysisContexts.performContextRebuildGuarded.performContextRebuild (package:analysis_server/src/context_manager.dart:549:40)
<asynchronous suspension>
#13     ContextManagerImpl._createAnalysisContexts.performContextRebuildGuarded (package:analysis_server/src/context_manager.dart:694:11)
<asynchronous suspension>
#14     _CancellingTaskQueue.queue.<anonymous closure> (package:analysis_server/src/context_manager.dart:978:15)
<asynchronous suspension>
#15     ContextManagerImpl.setRoots (package:analysis_server/src/context_manager.dart:364:5)
<asynchronous suspension>
#16     LegacyAnalysisServer.setAnalysisRoots (package:analysis_server/src/legacy_analysis_server.dart:792:9)
<asynchronous suspension>
#17     AnalysisSetAnalysisRootsHandler.handle (package:analysis_server/src/handler/legacy/analysis_set_analysis_roots.dart:46:7)
<asynchronous suspension>
#18     LegacyAnalysisServer.handleRequest.<anonymous closure>.<anonymous closure> (package:analysis_server/src/legacy_analysis_server.dart:576:11)
<asynchronous suspension>
#19     OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)
<asynchronous suspension>
#20     LegacyAnalysisServer.handleRequest.<anonymous closure> (package:analysis_server/src/legacy_analysis_server.dart:557:7)
<asynchronous suspension>


null
[RequestError code: SERVER_ERROR, message: type 'Null' is not a subtype of type 'Object' in type cast]
@dart-github-bot
Copy link
Collaborator

Summary: The Analysis Server encountered an error while processing the analysis.setAnalysisRoots request. The error occurred during YAML parsing of a lint configuration file, specifically when attempting to cast a Null value to an Object.

@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 Aug 10, 2024
@lrhn lrhn added analyzer-server and removed triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. labels Aug 12, 2024
@keertip keertip added crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. P3 A lower priority bug or feature request labels Aug 12, 2024
@keertip keertip changed the title An unexpected error was encountered by the Analysis Server. Please file an issue at https://github.com/dart-lang/sdk/issues/new/choose with the following details: Error while processing the analysis.setAnalysisRoots request Aug 12, 2024
@DanTup
Copy link
Collaborator

DanTup commented Aug 27, 2024

Closing this as a dupe of #55594 which has the same error/stack.

@DanTup DanTup closed this as completed Aug 27, 2024
@lucasjinreal
Copy link
Author

@DanTup

Hello. my I ask when will flutter have this patch update?

Currently using flutter latest 3.24.1 suffering from this issue for a long time....
Without dart LSP, i can not code flutter.....

@DanTup
Copy link
Collaborator

DanTup commented Sep 6, 2024

@lucasjinreal this issue has only recently been fixed and will be included in the next non-hotfix release of Dart/Flutter (which are usually approximately quarterly).

The issue is caused by invalid YAML in your analysis_options.yaml file, so the best fix is to correct the file. Please check the file for something like a blank entry in the lint list:

linter:
  rules:
    - camel_case_types
    - file_names
    - non_constant_identifier_names
    - comment_references
    -                  # this blank line triggered the error

If you cannot find a line that looks like this, please provide a copy of your analysis_options.yaml file (you may have multiple) and I can try to help spot the error.

@lucasjinreal
Copy link
Author

thanks, problem were solved!!

@MLDenzzl
Copy link

PS D:\beelabapp> dart analyze
Analyzing beelabapp...
An unexpected error was encountered by the Analysis Server.
Please file an issue at https://github.com/dart-lang/sdk/issues/new/choose with the following details:

Internal error: Failed to handle request: analysis.setAnalysisRoots
type 'Null' is not a subtype of type 'Object' in type cast
#0 YamlNodeExtension.valueOrThrow (package:analyzer/src/util/yaml.dart:147:36)
#1 _LintConfig.asString (package:analyzer/src/lint/config.dart:93:47)
#2 _LintConfig._parseYaml. (package:analyzer/src/lint/config.dart:136:29)
#3 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
#4 MapView.forEach (dart:collection/maps.dart:347:10)
#5 _LintConfig._parseYaml (package:analyzer/src/lint/config.dart:117:16)
#6 new LintConfig.parseMap (package:analyzer/src/lint/config.dart:38:62)
#7 parseConfig (package:analyzer/src/lint/config.dart:15:25)
#8 AnalysisOptionsImplExtensions.applyOptions (package:analyzer/src/analysis_options/apply_options.dart:229:18)
#9 ContextBuilderImpl._createOptionsMap (package:analyzer/src/dart/analysis/context_builder.dart:210:15)
#10 ContextBuilderImpl.createContext (package:analyzer/src/dart/analysis/context_builder.dart:135:15)
#11 new AnalysisContextCollectionImpl (package:analyzer/src/dart/analysis/analysis_context_collection.dart:108:36)
#12 ContextManagerImpl._createAnalysisContexts.performContextRebuildGuarded.performContextRebuild (package:analysis_server/src/context_manager.dart:549:40)

#13 ContextManagerImpl._createAnalysisContexts.performContextRebuildGuarded (package:analysis_server/src/context_manager.dart:694:11)

#14 _CancellingTaskQueue.queue. (package:analysis_server/src/context_manager.dart:978:15)

#15 ContextManagerImpl.setRoots (package:analysis_server/src/context_manager.dart:364:5)

#16 LegacyAnalysisServer.setAnalysisRoots (package:analysis_server/src/legacy_analysis_server.dart:793:9)

#17 AnalysisSetAnalysisRootsHandler.handle (package:analysis_server/src/handler/legacy/analysis_set_analysis_roots.dart:46:7)

#18 LegacyAnalysisServer.handleRequest.. (package:analysis_server/src/legacy_analysis_server.dart:577:11)

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

#20 LegacyAnalysisServer.handleRequest. (package:analysis_server/src/legacy_analysis_server.dart:558:7)

null
[RequestError code: SERVER_ERROR, message: type 'Null' is not a subtype of type 'Object' in type cast]

what can i do?

@DanTup
Copy link
Collaborator

DanTup commented Oct 28, 2024

@MLDenzzl it appears you may have invalid YAML in your analysis_options.yaml file. There's a fix to prevent the crash that will be included in the next stable release, but for now the best thing is to review your analysis_options.yaml for anything that looks invalid (see the comments above for some examples of the kinds of invalid data that triggered this previously).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

6 participants