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

analyzer plugins crash with The system cannot find the file specified. error #48682

Closed
DetachHead opened this issue Mar 28, 2022 · 14 comments
Closed
Assignees
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. cherry-pick-candidate Candidates to be cherry-picked P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DetachHead
Copy link

dart-code-checker/dart-code-metrics#749 (comment)

that doesn't seem to work anymore since i updated flutter to the master channel, no longer seeing errors in intellij despite having the plugin enabled in analysis_options.yaml:

analyzer:
  plugins:
    - dart_code_metrics

dart_code_metrics:
  rules:
    - no-empty-block
>flutter --version
Flutter 2.13.0-0.0.pre.242 • channel master • https://github.com/flutter/flutter.git
Framework • revision 10142b5817 (11 hours ago) • 2022-03-24 18:47:19 -0700
Engine • revision 816c8651d8
Tools • Dart 2.17.0 (build 2.17.0-232.0.dev) • DevTools 2.11.4

i see this when i open the analyzer diagnostics: image

ProcessException: The system cannot find the file specified.

  Command: C:\Users\amogus\Documents\flutter\bin\cache\dart-sdk\bin\pub.bat upgrade
#0      _ProcessImpl._runAndWait (dart:io-patch/process_patch.dart:487:7)
#1      _runNonInteractiveProcessSync (dart:io-patch/process_patch.dart:632:18)
#2      Process.runSync (dart:io-patch/process_patch.dart:68:12)
#3      PluginManager._computeFiles (package:analysis_server/src/plugin/plugin_manager.dart:641:28)
#4      PluginManager.filesFor (package:analysis_server/src/plugin/plugin_manager.dart:462:14)
#5      PluginManager.addPluginToContextRoot (package:analysis_server/src/plugin/plugin_manager.dart:328:23)
#6      PluginWatcher.addedDriver (package:analysis_server/src/plugin/plugin_watcher.dart:68:19)
#7      AnalysisDriver.configure (package:analyzer/src/dart/analysis/driver.dart:555:33)
#8      ContextBuilderImpl.createContext (package:analyzer/src/dart/analysis/context_builder.dart:137:12)
#9      new AnalysisContextCollectionImpl (package:analyzer/src/dart/analysis/analysis_context_collection.dart:67:36)
#10     ContextManagerImpl._createAnalysisContexts.performContextRebuildGuarded.performContextRebuild (package:analysis_server/src/context_manager.dart:449:40)
#11     ContextManagerImpl._createAnalysisContexts.performContextRebuildGuarded.performContextRebuild (package:analysis_server/src/context_manager.dart:444:41)
#12     ContextManagerImpl._createAnalysisContexts.performContextRebuildGuarded (package:analysis_server/src/context_manager.dart:559:17)

#13     ContextManagerImpl.setRoots (package:analysis_server/src/context_manager.dart:280:5)

#14     AnalysisServer.setAnalysisRoots (package:analysis_server/src/analysis_server.dart:456:7)

#15     AnalysisSetAnalysisRootsHandler.handle (package:analysis_server/src/handler/legacy/analysis_set_analysis_roots.dart:50:7)
@vsmenon vsmenon added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Mar 28, 2022
@srawlins
Copy link
Member

CC @scheglov @bwilkerson

I see we run pub directly in analysis_server, which might be removed in Dart 2.17? Actually, according to the changelog, it was removed in 2.16: https://github.com/dart-lang/sdk/blob/main/CHANGELOG.md#tools-1

pkg/analysis_server/lib/src/plugin/plugin_manager.dart:      var pubPath = path.join(path.dirname(vmPath), 'pub');

@srawlins srawlins added P1 A high priority bug; for example, a single project is unusable or has many test failures analyzer-server type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Apr 11, 2022
@srawlins
Copy link
Member

Marking as P1 unless we think this is not on the hot path for analyzer plugins.

@scheglov
Copy link
Contributor

Interestingly, I see from code that we should not be able to run pub, but somehow we get the plugin configured.
image

@scheglov
Copy link
Contributor

scheglov commented Apr 11, 2022

Ah, I still have pub in my xcodebuild/ReleaseARM64/dart-sdk/bin, remaining there since the time it still existed. I guess its time to nuke the whole directory.

@scheglov scheglov self-assigned this Apr 11, 2022
@scheglov
Copy link
Contributor

This seems to help.
https://dart-review.googlesource.com/c/sdk/+/240901

@srawlins
Copy link
Member

One more reference, but can be fixed separately:

pkg/analysis_server/lib/src/services/pub/pub_command.dart:      Platform.isWindows ? 'pub.bat' : 'pub',

copybara-service bot pushed a commit that referenced this issue Apr 11, 2022
Bug: #48682
Change-Id: Ifc024b381bce23b914a6849c9d82cf89292706a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240901
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
copybara-service bot pushed a commit that referenced this issue Apr 12, 2022
Bug: #48682
Change-Id: If8821f92b10e7f65b590911fceedd79b54dfec08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240940
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
@devoncarew
Copy link
Member

@srawlins @scheglov - I see the fix for this landed. See my comment on the dup of this issue - #48786 (comment); we'll probably want to file a cherry pick request for the fix.

@devoncarew devoncarew added the cherry-pick-candidate Candidates to be cherry-picked label Apr 13, 2022
@ookami-kb
Copy link

Hey, any news about it being cherry-picked to earlier versions?

With Flutter 3.0 and Dart 2.17 being released to stable, it now blocks using the analyzer plugins.

@fzyzcjy
Copy link
Contributor

fzyzcjy commented May 13, 2022

+1 This makes all plugins crash, especially dart_code_metrics which provides many useful linter rules in addition to official rules

@GabrielCR99
Copy link

+1. dart_code_metrics is still crashing because of this

@devj3ns
Copy link

devj3ns commented May 14, 2022

Hey @devoncarew,
is there an estimated date when this fix will be available in Dart >2.17.0 and Flutter >3.0.0?

@rrousselGit
Copy link

Could the fix be cherry-picked in the latest Dart stable release?

@srawlins
Copy link
Member

Could the fix be cherry-picked in the latest Dart stable release?

Yes we'll file a cherry-pick request.

copybara-service bot pushed a commit that referenced this issue May 17, 2022
Bug: #48682
Change-Id: Ifc024b381bce23b914a6849c9d82cf89292706a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240901
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
@gunasiriInthusan
Copy link

Execute flutter upgrade. With the new flutter version 3.0.1 it's working again.

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. cherry-pick-candidate Candidates to be cherry-picked P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests