Skip to content

analysis_server: Invalid file path (-32003) #39442

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

Closed
Urfoex opened this issue Nov 19, 2019 · 4 comments
Closed

analysis_server: Invalid file path (-32003) #39442

Urfoex opened this issue Nov 19, 2019 · 4 comments
Labels
analyzer-crash-report Issues which have been reported due to an analysis server crash legacy-area-analyzer Use area-devexp instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@Urfoex
Copy link

Urfoex commented Nov 19, 2019

Using packages for Debian.
Tried with Dart stable 2.5.2, 2.6.1, dev 2.7.0
Fails with 2.6.1 and 2.7.0
Works with 2.5.2

Using analysis_server with coc.nvim as described in wiki.

I tested with stagehand server-shelf and stagehand console-full with same behavior.
On completion I get Request failed: Invalid file path (-32003). console.dart.cocinfo.log

@DanTup
Copy link
Collaborator

DanTup commented Jun 2, 2020

@Urfoex Sorry for the delay in responding to this. I checked the log and the issue looks to be because you had onlyAnalyzeProjectsWithOpenFiles: true in initializationOptions but there was never a request for textDocument/didOpen. This means no paths are being analyzed, and therefore no paths are valid.

@srawlins srawlins added analyzer-crash-report Issues which have been reported due to an analysis server crash type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jun 11, 2020
@srawlins
Copy link
Member

This crash hasn't been reported since Dart 2.5.2. Please re-open if you see this crash again.

@dJani97
Copy link

dJani97 commented Feb 16, 2022

I just had a similar crash. The output of the swagger_dart_code_generator package crashes my analyzer in a reproducible way.

Changing the generated code even the slightest bit, e.g. deleting a random method instantly fixes the issue.

I've tried copying the generated files to another project so I can share them separately, but it doesn't crash anymore.

Managed to capture the following logs:

[Error - 12:29:02 AM] Request textDocument/codeAction failed.
  Message: An error occurred while handling textDocument/codeAction request
  Code: -32001 
[Error - 12:29:02 AM] An error occurred while handling textDocument/codeAction request: Bad state: Expected existing element: root::package:projectname_mobile/presentation/web/swagger_generated_code/reporting.enums.swagger.dart::@unit::package:projectname_mobile/presentation/web/swagger_generated_code/reporting.enums.swagger.dart::@getter::$UsersUserIdPlansAggregatedGetAggregationTypeMap
#0      LinkedElementFactory.elementOfReference (package:analyzer/src/summary2/linked_element_factory.dart:143:7)
#1      LinkedElementFactory.buildExportNamespace (package:analyzer/src/summary2/linked_element_factory.dart:49:21)
#2      LibraryElementImpl.exportNamespace (package:analyzer/src/dart/element/element.dart:3823:42)
#3      TopLevelDeclarations.addElement.addSingle (package:analysis_server/src/services/correction/fix/dart/top_level_declarations.dart:59:36)
#4      TopLevelDeclarations.addElement (package:analysis_server/src/services/correction/fix/dart/top_level_declarations.dart:68:5)
#5      TopLevelDeclarations.withName (package:analysis_server/src/services/correction/fix/dart/top_level_declarations.dart:47:7)
<asynchronous suspension>
#6      ImportLibrary._importLibraryForElement (package:analysis_server/src/services/correction/dart/import_library.dart:272:33)
<asynchronous suspension>

Flutter:
Flutter (Channel stable, 2.10.1, on Microsoft Windows [Version 10.0.22000.493], locale en-US)

@DanTup
Copy link
Collaborator

DanTup commented Feb 16, 2022

@dJani97 there's another open issue about that specific error here:

#48082

If you're able to get a repro you can share, please do post it on that issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-crash-report Issues which have been reported due to an analysis server crash legacy-area-analyzer Use area-devexp instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants