flutter-intellij icon indicating copy to clipboard operation
flutter-intellij copied to clipboard

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

Open alexander-doroshko opened this issue 1 year ago • 21 comments

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... 

alexander-doroshko avatar May 23 '24 12:05 alexander-doroshko

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:

alexander-doroshko avatar May 23 '24 12:05 alexander-doroshko

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.

conghaonet avatar May 24 '24 07:05 conghaonet

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...

alexander-doroshko avatar May 27 '24 07:05 alexander-doroshko

I have also the same issue

f10smobileteam avatar May 27 '24 07:05 f10smobileteam

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

  • Dart SDK 3.4.1
  • Dart IntelliJ 241.17502
  • IntelliJ IDEA 2024.1.2
  • Mac OS X 14.5

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"...

kjxbyz avatar May 27 '24 09:05 kjxbyz

Same problem here

GattoExpress999 avatar May 28 '24 08:05 GattoExpress999

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

iBog avatar May 28 '24 11:05 iBog

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

jwren avatar May 29 '24 18:05 jwren

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.

pglbiscuite avatar Jun 01 '24 15:06 pglbiscuite

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

jwren avatar Jun 10 '24 23:06 jwren

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>

philitell avatar Jun 19 '24 05:06 philitell

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

pglbiscuite avatar Jun 19 '24 07:06 pglbiscuite

@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.

philitell avatar Jun 19 '24 12:06 philitell

@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:

  • Open the registry, Help > Find Action (Ctrl+Shift+A) and search for Registry...
  • Append --instrumentation-log-file=/path/to/file/das_log.txt to the existing registry entry for dart.server.additional.arguments.
  • Restart analysis server
  • Collect / review / attach logs

jwren avatar Jun 20 '24 17:06 jwren

Version information

  • Dart SDK 3.4.3
  • Android Studio Jellyfish | 2023.3.1 Patch 1
  • Flutter - Channel stable, 3.22.2
  • Ubuntu 22.04.4 LTS

philitell avatar Jun 20 '24 17:06 philitell

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

JakobProssinger avatar Jun 21 '24 11:06 JakobProssinger

@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.

pglbiscuite avatar Jun 28 '24 08:06 pglbiscuite

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

Ortes avatar Jul 09 '24 14:07 Ortes

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: @.***>

f10smobileteam avatar Jul 10 '24 03:07 f10smobileteam

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.

philitell avatar Jul 10 '24 06:07 philitell

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.

pcpenpal avatar Jul 14 '24 08:07 pcpenpal

With the latest Flutter and Dart Plugin, a correct sdk setting in my pubspec.yaml, and a restart, I am not seeing this issue reproduced. Are there still individuals using dart.macros.support? If so, please include the version of the Flutter Plugin and Dart plugin.

jwren avatar Nov 20 '24 00:11 jwren

Without additional information we're not able to resolve this issue, so it will be closed at this time. You're still free to add more info and respond to any questions above, though. We'll reopen the case if you do. Thanks for your contribution!

github-actions[bot] avatar Dec 05 '24 00:12 github-actions[bot]