Skip to content

[tool_crash] RpcException trying to start a widget preview using a DTD connection that already has a widget preview #179883

@DanTup

Description

@DanTup

I tried to start a widget preview using the DTD URI for my VS Code instance. It failed with the error below (which I presume is because the widget preview inside VS Code was already connected to this instance of DTD).

I think it should either work, or it prints a friendly message explaining that there is already a widget preview connecting to this instance of DTD.

C:\Users\danny\AppData\Local\Temp\flutter_tools.c4b78f7a\widget_preview_scaffoldd2781a7f\preview_manifest.json
Finding previews in D:\Dev\Test Projects\flutter_counter...
Found 4 previews.

Oops; flutter has exited unexpectedly: "JSON-RPC error 111: Service already registered".
A crash report has been written to C:\Users\danny\AppData\Local\Temp\flutter_tools.c4b78f7a\widget_preview_scaffoldd2781a7f\flutter_01.log
This crash may already be reported. Check GitHub for similar crashes.
https://github.com/flutter/flutter/issues?q=is%3Aissue+JSON-RPC+error+111%3A+Service+already+registered

To report your crash to the Flutter team, first read the guide to filing a bug.
https://flutter.dev/to/report-bugs

@bkonyi

(The info below is from the URL in the tool crash output)

Command

flutter widget-preview start --dtd-url ws://127.0.0.1:53214/Ot7rKr-RbaU=

Steps to Reproduce

  1. Open the widget preview in VS Code
  2. Copy the DTD URI (from the command palette of language status area)
  3. Run flutter widget-preview start --dtd-url ws://127.0.0.1:53214/xxxxxx= (replacing this URI with the one you copied)

Logs

RpcException

package:json_rpc_2/src/client.dart 122:62                           Client.sendRequest
package:json_rpc_2/src/peer.dart 98:15                              Peer.sendRequest
package:dtd/src/dart_tooling_daemon.dart 106:23                     DartToolingDaemon.registerService
package:flutter_tools/src/widget_preview/dtd_services.dart 161:14   WidgetPreviewDtdServices._registerServices
package:flutter_tools/src/widget_preview/dtd_services.dart 120:11   WidgetPreviewDtdServices.connect
===== asynchronous gap ===========================
package:flutter_tools/src/commands/widget_preview.dart 402:7        WidgetPreviewStartCommand.configureDtd
===== asynchronous gap ===========================
package:flutter_tools/src/commands/widget_preview.dart 359:5        WidgetPreviewStartCommand.runCommand
===== asynchronous gap ===========================
package:flutter_tools/src/runner/flutter_command.dart 1564:27       FlutterCommand.run.<fn>
===== asynchronous gap ===========================
package:flutter_tools/src/base/context.dart 154:19                  AppContext.run.<fn>
===== asynchronous gap ===========================
package:args/command_runner.dart 212:13                             CommandRunner.runCommand
===== asynchronous gap ===========================
package:flutter_tools/src/runner/flutter_command_runner.dart 487:9  FlutterCommandRunner.runCommand.<fn>
===== asynchronous gap ===========================
package:flutter_tools/src/base/context.dart 154:19                  AppContext.run.<fn>
===== asynchronous gap ===========================
package:flutter_tools/src/runner/flutter_command_runner.dart 422:5  FlutterCommandRunner.runCommand
===== asynchronous gap ===========================
package:flutter_tools/runner.dart 104:11                            run.<fn>.<fn>
===== asynchronous gap ===========================
package:flutter_tools/src/base/context.dart 154:19                  AppContext.run.<fn>
�[33m[!]�[39m Flutter (Channel master, 3.40.0-1.0.pre-105, on Microsoft Windows [Version 10.0.26100.7462], locale en-GB) [3.3s]
    �[32m•�[39m Flutter version 3.40.0-1.0.pre-105 on channel master at D:\Dev\Google\Flutter\Flutter main
    �[33m!�[39m Warning: `dart` on your path resolves to D:\Tools\Dart\Stable\bin\dart.exe, which is not inside your current Flutter SDK checkout at
      D:\Dev\Google\Flutter\Flutter main. Consider adding D:\Dev\Google\Flutter\Flutter main\bin to the front of your path.
    �[33m!�[39m Upstream repository git@github.com:DanTup/flutter.git is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to git@github.com:DanTup/flutter.git to dismiss this error.
    �[32m•�[39m Framework revision 6519f99911 (5 days ago), 2025-12-10 00:18:27 -0500
    �[32m•�[39m Engine revision 6519f99911
    �[32m•�[39m Dart version 3.11.0 (build 3.11.0-227.0.dev)
    �[32m•�[39m DevTools version 2.53.0
    �[32m•�[39m Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-native-assets, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
    �[32m•�[39m If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and
      upgrades.

�[32m[✓]�[39m Windows Version (11 Pro 64-bit, 24H2, 2009) [835ms]

�[33m[!]�[39m Android toolchain - develop for Android devices (Android SDK version 35.0.0) [1,814ms]
    �[32m•�[39m Android SDK at C:\Users\danny\AppData\Local\Android\sdk
    �[32m•�[39m Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
    �[32m•�[39m Platform android-36, build-tools 35.0.0
    �[32m•�[39m Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    �[32m•�[39m Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)
    �[33m!�[39m Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

�[32m[✓]�[39m Chrome - develop for the web [55ms]
    �[32m•�[39m Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

�[32m[✓]�[39m Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.5) [54ms]
    �[32m•�[39m Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    �[32m•�[39m Visual Studio Community 2022 version 17.10.35122.118
    �[32m•�[39m Windows 10 SDK version 10.0.26100.0

�[32m[✓]�[39m Connected device (3 available) [88ms]
    �[32m•�[39m Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26100.7462]
    �[32m•�[39m Chrome (web)      • chrome  • web-javascript • Google Chrome 143.0.7499.40
    �[32m•�[39m Edge (web)        • edge    • web-javascript • Microsoft Edge 143.0.3650.75

�[32m[✓]�[39m Network resources [554ms]
    �[32m•�[39m All expected network resources are available.

�[33m!�[39m Doctor found issues in 2 categories.

Flutter Application Metadata

Type: malformed
Version: 0.0.1
Material: true
Android X: false
Module: false
Plugin: false
Android package: null
iOS bundle identifier: null
Creation channel: null
Creation framework version: null

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: error messageError messages from the Flutter frameworka: widget previewsIssues related to the Widget Previewer toolingc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processfound in release: 3.38Found to occur in 3.38found in release: 3.40Found to occur in 3.40has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions