flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.97k stars 317 forks source link

Invalid argument (uri): URI scheme 'c' is not supported #7450

Open alexander-doroshko opened 4 months ago

alexander-doroshko commented 4 months ago

The issue originally filed as https://youtrack.jetbrains.com/issue/IDEA-353930 but it needs to be fixed in the Flutter plugin.

Logs show the problem:


1716442455851 => {"id":"6","method":"analysis.setSubscriptions","params":{"subscriptions":{"CLOSING_LABELS":["file:///C:/Users/mitja/src/myproject/myproject_flutter/lib/model/partnership.dart"],"OVERRIDES...
1716442455851 => {"id":"7","method":"flutter.setSubscriptions","params":{"subscriptions":{"OUTLINE":["C:\\Users\\mitja\\src\\myproject\\myproject_flutter\\lib\\model\\partnership.dart"]}}}
1716442455978 <= {"id":"6"}
1716442456000 <= {"id":"7","error":{"code":"SERVER_ERROR","message":"Invalid argument (uri): URI scheme 'c' is not supported. Allowed schemes are 'file', 'dart-macro+file'.: \"c:/Users/mitja/src/myproj... 
alexander-doroshko commented 4 months ago

Until the Flutter plugin build with the fix is available, the workaround is to downgrade the Dart plugin to the previous version. Depending on the IDE version, it is one of these:

conghaonet commented 4 months ago

The issue originally filed as https://youtrack.jetbrains.com/issue/IDEA-353930 but it needs to be fixed in the Flutter plugin.

  • Dart SDK 3.4.1
  • Dart IntelliJ 233.15271
  • Android Studio Jellyfish | 2023.3.1 Patch 1
  • Windows 10 10.0

Logs show the problem:

1716442455851 => {"id":"6","method":"analysis.setSubscriptions","params":{"subscriptions":{"CLOSING_LABELS":["file:///C:/Users/mitja/src/myproject/myproject_flutter/lib/model/partnership.dart"],"OVERRIDES...
1716442455851 => {"id":"7","method":"flutter.setSubscriptions","params":{"subscriptions":{"OUTLINE":["C:\\Users\\mitja\\src\\myproject\\myproject_flutter\\lib\\model\\partnership.dart"]}}}
1716442455978 <= {"id":"6"}
1716442456000 <= {"id":"7","error":{"code":"SERVER_ERROR","message":"Invalid argument (uri): URI scheme 'c' is not supported. Allowed schemes are 'file', 'dart-macro+file'.: \"c:/Users/mitja/src/myproj... 

I have the same error.

alexander-doroshko commented 4 months ago

The issue is not Windows-specific, it happens on Mac/Linux as well:

1716779956635 => {"id":"11","method":"flutter.setSubscriptions","params":{"subscriptions":{"OUTLINE":["/Users/hirogakatageri/Projects/edamama/edamama-mobile-app/lib/core/network/usecase/guest_token_mi...
1716779956639 <= {"id":"11","error":{"code":"SERVER_ERROR","message":"Invalid argument (uri): URI is not a valid file:// URI: \"/Users/hirogakatageri/Projects/edamama/edamama-mobile-app/lib/core/netwo...
f10smobileteam commented 4 months ago

I have also the same issue

kjxbyz commented 4 months ago

Dart analysis issue

Invalid argument (uri): URI is not a valid file:// URI: "/Users/ying/work/frontend-expert-app/lib/main_common.dart"

Version information

Details

Invalid argument (uri): URI is not a valid file:// URI: "/Users/ying/work/frontend-expert-app/lib/main_common.dart"

#0      _VirtualFileClientUriConverter.fromClientUri (package:analyzer_plugin/src/utilities/client_uri_converter.dart:98:7)
#1      _VirtualFileClientUriConverter.fromClientFilePath (package:analyzer_plugin/src/utilities/client_uri_converter.dart:91:7)
#2      new FlutterSetSubscriptionsParams.fromJson.<anonymous closure>.<anonymous closure> (package:analysis_server/protocol/protocol_generated.dart:10151:44)
#3      JsonDecoder.decodeList (package:analyzer_plugin/src/protocol/protocol_internal.dart:347:27)
#4      new FlutterSetSubscriptionsParams.fromJson.<anonymous closure> (package:analysis_server/protocol/protocol_generated.dart:10147:29)
#5      JsonDecoder.decodeMap.<anonymous closure> (package:analyzer_plugin/src/protocol/protocol_internal.dart:373:31)
#6      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
#7      JsonDecoder.decodeMap (package:analyzer_plugin/src/protocol/protocol_internal.dart:365:16)
#8      new FlutterSetSubscriptionsParams.fromJson (package:analysis_server/protocol/protocol_generated.dart:10142:37)
#9      new FlutterSetSubscriptionsParams.fromRequest (package:analysis_server/protocol/protocol_generated.dart:10164:42)
#10     FlutterSetSubscriptionsHandler.handle (package:analysis_server/src/handler/legacy/flutter_set_subscriptions.dart:20:48)
#11     LegacyAnalysisServer.handleRequest.<anonymous closure>.<anonymous closure> (package:analysis_server/src/legacy_analysis_server.dart:580:25)
#12     OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:172:29)
#13     LegacyAnalysisServer.handleRequest.<anonymous closure> (package:analysis_server/src/legacy_analysis_server.dart:561:29)
#14     _rootRun (dart:async/zone.dart:1399:13)
#15     _CustomZone.run (dart:async/zone.dart:1301:19)
#16     _runZoned (dart:async/zone.dart:1826:10)
#17     runZonedGuarded (dart:async/zone.dart:1814:12)
#18     LegacyAnalysisServer.handleRequest (package:analysis_server/src/legacy_analysis_server.dart:557:5)
#19     LegacyAnalysisServer.handleRequestOrResponse (package:analysis_server/src/legacy_analysis_server.dart:621:7)
#20     _rootRunUnary (dart:async/zone.dart:1407:47)
#21     _CustomZone.runUnary (dart:async/zone.dart:1308:19)
#22     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1217:7)
#23     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:365:11)
#24     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:297:7)
#25     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63:11)
#26     _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)
#27     new _DebounceRequests.<anonymous closure>.<anonymous closure> (package:analysis_server/src/server/debounce_requests.dart:50:20)
#28     _rootRun (dart:async/zone.dart:1391:47)
#29     _CustomZone.run (dart:async/zone.dart:1301:19)
#30     _CustomZone.runGuarded (dart:async/zone.dart:1209:7)
#31     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1249:23)
#32     _rootRun (dart:async/zone.dart:1399:13)
#33     _CustomZone.run (dart:async/zone.dart:1301:19)
#34     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1233:23)
#35     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#36     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#37     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
#38     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

Debug log

1716801911455 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/modules/login/widgets/phone_code.dart","errors":[]}}
1716801911456 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/modules/debug/debug.dart","errors":[]}}
1716801911457 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/modules/debug/view/apple_oauth2_page.dart","errors":[]}}
1716801911458 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/modules/debug/view/request_page.dart","errors":[]}}
1716801911459 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/modules/debug/view/facebook_oauth2_page.dart","errors":[]}}
1716801911460 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/modules/debug/view/request_detail_page.dart","errors":[]}}
1716801911464 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/modules/debug/view/view.dart","errors":[]}}
1716801911466 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/modules/debug/view/debug_page.dart","errors":[]}}
1716801911466 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/modules/debug/view/google_oauth2_page.dart","errors":[]}}
1716801911467 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/modules/debug/widgets/widgets.dart","errors":[]}}
1716801911469 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/modules/debug/widgets/title.dart","errors":[]}}
1716801911469 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/modules/debug/widgets/content.dart","errors":[]}}
1716801911482 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
1716801912808 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1716801914158 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
1716801916845 <= {"id":"5"}
1716801962916 => {"id":"6","method":"analysis.setPriorityFiles","params":{"files":["file:///Users/ying/work/frontend-expert-app/lib/main_common.dart"]},"clientRequestTime":1716801962915}
1716801962917 => {"id":"7","method":"analysis.setSubscriptions","params":{"subscriptions":{"CLOSING_LABELS":["file:///Users/ying/work/frontend-expert-app/lib/main_common.dart"],"OVERRIDES":["file:///U...
1716801962920 <= {"id":"6"}
1716801962920 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1716801962940 <= {"id":"7"}
1716801962999 => {"id":"8","method":"flutter.setSubscriptions","params":{"subscriptions":{"OUTLINE":["/Users/ying/work/frontend-expert-app/lib/main_common.dart"]}}}
1716801963380 => {"id":"9","method":"edit.getAssists","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/main_common.dart","offset":6627,"length":0},"clientRequestTime":1716801963380}
1716801964353 <= {"event":"analysis.errors","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/main_common.dart","errors":[{"severity":"INFO","type":"TODO","location":{"file":"file:///U...
1716801964368 <= {"event":"analysis.highlights","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/main_common.dart","regions":[{"type":"DIRECTIVE","offset":0,"length":24},{"type":"BUIL...
1716801964402 <= {"event":"analysis.navigation","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/main_common.dart","regions":[{"offset":7,"length":16,"targets":[0]},{"offset":32,"leng...
1716801964412 <= {"event":"analysis.closingLabels","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/main_common.dart","labels":[{"offset":3362,"length":344,"label":"NotificationDetail...
1716801964440 <= {"event":"analysis.outline","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/main_common.dart","kind":"LIBRARY","outline":{"element":{"kind":"COMPILATION_UNIT","name"...
1716801964440 <= {"event":"analysis.overrides","params":{"file":"file:///Users/ying/work/frontend-expert-app/lib/main_common.dart","overrides":[]}}
1716801964484 <= {"id":"8","error":{"code":"SERVER_ERROR","message":"Invalid argument (uri): URI is not a valid file:// URI: \"/Users/ying/work/frontend-expert-app/lib/main_common.dart\"","stackTrace"...
GattoExpress999 commented 4 months ago

Same problem here

iBog commented 4 months ago

same: • Flutter (Channel stable, 3.22.1, on Microsoft Windows [Version 10.0.22631.3593], locale ru-RU) • Flutter version 3.22.1 on channel stable at c:\Apps\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision a14f74ff3a (6 days ago), 2024-05-22 11:08:21 -0500 • Engine revision 55eae6864b • Dart version 3.4.1 • DevTools version 2.34.3

LOG: issue.md

jwren commented 4 months ago

Some follow up: https://github.com/flutter/flutter-intellij/pull/7466

pglbiscuite commented 4 months ago

Yes @alexander-doroshko is right. It took me 8 hours to solve this but managed to fix it eventually. I have a simple step by step guide on how to do it as well, mostly generated with ChatGPT 4o, but after countless hours of trying everything, it sure feels go to have it fixed.

  1. Download the Compatible Version of Dart Plugin Based on the error message and the recommended versions, you should download one of the compatible versions of the Dart plugin. For example, since your current build is AI-233.14808.21, I used version 233.15123.

Depending on the IDE version, it is one of these:

241.15845 233.15123 232.10313

Download the compatible version of the Dart plugin from the JetBrains plugin repository or another trusted source. The official plugin repository link is: Dart Plugin Repository

  1. Uninstall the Current Dart Plugin Open Android Studio. Go to File -> Settings (or Ctrl + Alt + S). In the Settings window, navigate to Plugins. Search for the Dart plugin. Uninstall the current Dart plugin by clicking the Uninstall button.
  2. Install the Downloaded Version of Dart Plugin In the Plugins window, click on the gear icon at the top right and select Install Plugin from Disk.... Navigate to the location where you downloaded the Dart plugin .zip file. Select the file and follow the prompts to install it.
  3. Restart Android Studio After the installation, restart Android Studio to apply the changes.

By following these steps, you should be able to downgrade the Dart plugin to a version that is compatible with your current build of Android Studio. If you encounter any issues during the process, feel free to ask for further assistance.

One of the main issues for me, was the 'Flutter Outline' not working, and the cntrl + left click wasn't working either.

I really hope this helps you as saves you all the time and emotions of not knowing how or what to do.

jwren commented 3 months ago

This should be resolved with version 80 of the Flutter IJ plugin

philitell commented 3 months ago

I'm getting the same error with flutter plugin version 80:

## Dart analysis issue

Invalid argument (uri): URI is not a valid file:// URI: "/home/phil/Projects/mag/mag_future_app/lib/screens/subscription_update_screen.dart"

## Version information

- Dart SDK 3.4.3
- Dart IntelliJ 233.15271
- Android Studio Jellyfish | 2023.3.1 Patch 1
- Linux 6.5.0-10040-tuxedo

## Details

Invalid argument (uri): URI is not a valid file:// URI: "/home/Username/Projects/screen.dart"

#0      _VirtualFileClientUriConverter.fromClientUri (package:analyzer_plugin/src/utilities/client_uri_converter.dart:98:7)
#1      _VirtualFileClientUriConverter.fromClientFilePath (package:analyzer_plugin/src/utilities/client_uri_converter.dart:91:7)
#2      new SourceFileEdit.fromJson (package:analyzer_plugin/protocol/protocol_common.dart:4425:35)
#3      new SourceChange.fromJson.<anonymous closure> (package:analyzer_plugin/protocol/protocol_common.dart:4140:32)
#4      JsonDecoder.decodeList (package:analyzer_plugin/src/protocol/protocol_internal.dart:347:27)
#5      new SourceChange.fromJson (package:analyzer_plugin/protocol/protocol_common.dart:4136:29)
#6      new PrioritizedSourceChange.fromJson (package:analyzer_plugin/protocol/protocol_generated.dart:3642:31)
#7      new EditGetAssistsResult.fromJson.<anonymous closure> (package:analyzer_plugin/protocol/protocol_generated.dart:1752:41)
#8      JsonDecoder.decodeList (package:analyzer_plugin/src/protocol/protocol_internal.dart:347:27)
#9      new EditGetAssistsResult.fromJson (package:analyzer_plugin/protocol/protocol_generated.dart:1748:31)
#10     new EditGetAssistsResult.fromResponse (package:analyzer_plugin/protocol/protocol_generated.dart:1763:33)
#11     EditGetAssistsHandler.handle (package:analysis_server/src/handler/legacy/edit_get_assists.dart:70:48)
<asynchronous suspension>
#12     LegacyAnalysisServer.handleRequest.<anonymous closure>.<anonymous closure> (package:analysis_server/src/legacy_analysis_server.dart:580:11)
<asynchronous suspension>
#13     OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:172:14)
<asynchronous suspension>
#14     LegacyAnalysisServer.handleRequest.<anonymous closure> (package:analysis_server/src/legacy_analysis_server.dart:561:7)
<asynchronous suspension>
pglbiscuite commented 3 months ago

@philitell Try using the fix that worked for me. It is written above.

philitell commented 3 months ago

@pglbiscuite you are my hero!!! I downgraded the dart-plugin to the compatible version for my Android Studio - and now it works. Also "show context actions" (alt+enter) are working again.

jwren commented 3 months ago

@philitell & @pglbiscuite Thanks for the comments, re-opening to take a look. Any additional information would be helpful, which OS are you using, which version of Flutter SDK, etc.

Switching back to an old version of the IJ plugins is a temporary solution.

To record the DAS logs which also may be helpful here:

philitell commented 3 months ago

Version information

JakobProssinger commented 3 months ago

I believe this is an issue regarding the custom_lint package or the "analysis_options.yaml" file. After I removed the custom_lint package from my analysis file I no longer received any error messages.

Although I hadn't configured the custom_lint package. Anyhow this might solve the problem for some people

pglbiscuite commented 3 months ago

@pglbiscuite you are my hero!!! I downgraded the dart-plugin to the compatible version for my Android Studio - and now it works. Also "show context actions" (alt+enter) are working again.

My friend, I am really happy it worked for you, it took my at least 8 hours of constant struggle before I could make it work, so the fact that you did not have to go through all of that brings me Joy.

Wish you nothing but the best! Peace & Love.

Ortes commented 2 months ago

Downgrading is not a solution anymore because it makes my debugger not breaking as breakpoints. The device break (I can see it in the console in chrome) but Android Studio does nothing. Please fix this, this makes the ide unusable :/

[✓] Flutter (Channel stable, 3.22.2, on Ubuntu 22.04.4 LTS 6.5.0-41-generic, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.89.1)
[✓] Connected device (2 available)
[✓] Network resources
f10smobileteam commented 2 months ago

Try Uninstalling both Flutter and Dart plugin and reinstall latest version then try reindexing project.

Karmokar Surjit Junior Software Developer F10S Mobile Apps Team

On Tue, 9 Jul, 2024 at 8:37 PM, Ortes @.***> wrote:

Downgrading is not a solution anymore because it makes my debugger not breaking as breakpoints. The device break (I can see it in the console in chrome) but Android Studio does nothing. Please fix this, this makes the ide unusable :/

— Reply to this email directly, view it on GitHub https://github.com/flutter/flutter-intellij/issues/7450#issuecomment-2217905050, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDUP55Y3BKX6YACTTEDMDE3ZLPYQZAVCNFSM6AAAAABIFSWZXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJXHEYDKMBVGA . You are receiving this because you commented.Message ID: @.***>

philitell commented 2 months ago

Downgrading is not a solution anymore because it makes my debugger not breaking as breakpoints. The device break (I can see it in the console in chrome) but Android Studio does nothing. Please fix this, this makes the ide unusable :/

[✓] Flutter (Channel stable, 3.22.2, on Ubuntu 22.04.4 LTS 6.5.0-41-generic, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.89.1)
[✓] Connected device (2 available)
[✓] Network resources

Yes i can confirm that - debugger is not working when downgrading the package.

pcpenpal commented 2 months ago

It is too complex to explain why the solution I will describe works. Just do the following:

  1. Run the "Find Action..." command in the menu bar - Help menu.
  2. Search "Registry..." action by just typing "registry" and run it.
  3. Turn off the "dart.macros.support" boolean flag.
  4. Restart the IDE and do some whatever cleanup e.g. flutter pub get and just restart the IDE one more.

I think the bug is in the Dart plugin. For now, we need this workaround.