Skip to content

[tool_crash] flutter widget-preview start crashes with RpcException - Unknown method "Lsp.dart/workspace/getFlutterWidgetPreviews" #187367

Closed

Description

@Alimmzdev

Command

flutter widget-preview start

Steps to Reproduce

  1. Create a Flutter package project
  2. Run flutter widget-preview start in the project root
  3. Wait for "Connected to DTD" message
  4. Flutter crashes immediately after connecting

Expected Behavior

Widget Preview should start successfully and open in Chrome browser.

Actual Behavior

Crashes with:
JSON-RPC error -32601 (method not found):
Unknown method "Lsp.dart/workspace/getFlutterWidgetPreviews"

Environment

Flutter version: 3.44.0 (stable)
Dart version: 3.12.0
OS: Windows 11 (24H2)
IDE: Android Studio
Project type: Flutter Package (not a full app)

Logs

RpcException

package:json_rpc_2/src/client.dart 134:62                            Client.sendRequest
package:json_rpc_2/src/peer.dart 116:15                              Peer.sendRequest
package:dtd/src/dart_tooling_daemon.dart 218:36                      DartToolingDaemon.call
package:flutter_tools/src/widget_preview/dtd_services.dart 176:48    WidgetPreviewDtdServices.getFlutterWidgetPreviews

Flutter Application Metadata

Type: malformed
Version: 0.0.1
Material: true

Activity

  1. added
    in triagePresently being triaged by the triage team
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    toolAffects the "flutter" command-line tool. See also t: labels.
    needs repro infoAutomated crash report whose cause isn't yet known
    and removed
    in triagePresently being triaged by the triage team
    on Jun 2, 2026
  2. mbcorona commented on Jun 2, 2026

    @mbcorona
    Member

    Thanks for the report. I couldn't reproduce this on macOS (Flutter 3.44.0) — flutter widget-preview start on a clean flutter create --template=package project starts fine, with the analysis server registering the LSP service and reaching "Done loading previews". The -32601 Unknown method "…getFlutterWidgetPreviews" means the analysis server on your machine isn't exposing that LSP method, which usually points to a Dart SDK / analysis-server version mismatch rather than the project itself.
    To narrow it down, could you share:

    Your full flutter doctor -v
    The verbose log: flutter widget-preview start -v (this shows whether the analysis server registers the LSP service and which SDK versions are in play)
    Whether you have a separate Dart SDK on your PATH (vs. the one bundled with this Flutter)

    Also, does it reproduce on a brand-new flutter create --template=package project? That'll help confirm whether it's Windows-specific or an SDK-state issue on your machine.

  3. Alimmzdev commented on Jun 2, 2026

    @Alimmzdev
    Author

    Hi @mbcorona ,

    Thanks for the quick follow-up!

    Just to clarify, I didn't write this issue manually. Flutter itself suggested filing it in the terminal after the command failed. I simply confirmed and submitted it.

    The issue reproduces on my Windows machine in a corporate environment. I'll add the requested information (flutter doctor -v output and the verbose log) tomorrow.

    Thanks for your patience!

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jun 2, 2026
  5. Alimmzdev commented on Jun 3, 2026

    @Alimmzdev
    Author

    @mbcorona

    flutter doctor -v

    [√] Flutter (Channel stable, 3.44.0, on Microsoft Windows [Version 10.0.26100.6584], locale en-US)
    [√] Windows Version (Windows 11 or higher, 24H2, 2009)
    [√] Android toolchain - develop for Android devices (Android SDK version 37.0.0)
    [√] Chrome - develop for the web
    [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.14.19)
    [√] Connected device (4 available)
    [√] Network resources
    • No issues found!
    

    flutter widget-preview start -v

    The verbose log is attached above (the original report). Key observations from it:

    • Flutter 3.44.0, stable channel, Windows 11 24H2
    • The DTD connects and registers its services successfully (Connected to DTD and registered services)
    • Analysis server sends a $/progress ANALYZING → end event, meaning it does start up
    • The crash fires immediately after with: JSON-RPC error -32601 (method not found): Unknown method "Lsp.dart/workspace/getFlutterWidgetPreviews"
    • A crash report was sent to Google (report ID: 77cd65d419280f17)
    [  +17 ms] Registered DTD method: hotRestartPreviewer
    [        ] Registered DTD method: isWindows
    [        ] Registered DTD method: resolveUri
    [   +1 ms] Registered DTD method: setPreference
    [        ] Registered DTD method: getPreference
    [        ] Registered DTD method: getDevToolsUri
    [        ] Connected to DTD and registered services.
    [ +867 ms] "flutter start" took 4,596ms.
    
    [  +92 ms] Sending crash report to Google.
    [ +992 ms] Crash report sent (report ID: 77cd65d419280f17)
    [        ] Oops; flutter has exited unexpectedly: "JSON-RPC error -32601
    (method not
               found): Unknown method
    "Lsp.dart/workspace/getFlutterWidgetPreviews".".
    [   +7 ms] executing: C:\Program Files\Android\Android Studio1\jbr\bin\java   
    -version
    [  +74 ms] Exit code 0 from: C:\Program Files\Android\Android
    Studio1\jbr\bin\java -version
    [        ] openjdk version "21.0.10" 2026-01-20
               OpenJDK Runtime Environment (build 21.0.10+-14961533-b1163.108)    
               OpenJDK 64-Bit Server VM (build 21.0.10+-14961533-b1163.108, mixed 
               mode)
    [ +108 ms] executing: [C:\DEV\flutter/] git -c log.showSignature=false log -n
    1 --pretty=format:%ar
    [  +36 ms] Exit code 0 from: git -c log.showSignature=false log -n 1
    --pretty=format:%ar
    [        ] 3 weeks ago
    [  +11 ms] executing: C:\Program Files (x86)\Microsoft Visual
    Studio\Installer\vswhere.exe -format json -products * -utf8 -latest -version  
    16 -requires Microsoft.VisualStudio.Workload.NativeDesktop
    Microsoft.VisualStudio.Component.VC.Tools.x86.x64
    Microsoft.VisualStudio.Component.VC.CMake.Project
    [  +29 ms] Exit code 0 from: C:\Program Files (x86)\Microsoft Visual
    Studio\Installer\vswhere.exe -format json -products * -utf8 -latest -version  
    16 -requires Microsoft.VisualStudio.Workload.NativeDesktop
    Microsoft.VisualStudio.Component.VC.Tools.x86.x64
    Microsoft.VisualStudio.Component.VC.CMake.Project
    [        ] [
                 {
                   "instanceId": "79e3a001",
                   "installDate": "2025-09-23T11:21:21Z",
                   "installationName": "VisualStudio/17.14.19+36623.8",
                   "installationPath": "C:\\Program Files\\Microsoft Visual       
                   Studio\\2022\\Community",
                   "installationVersion": "17.14.36623.8",
                   "productId": "Microsoft.VisualStudio.Product.Community",       
                   "productPath": "C:\\Program Files\\Microsoft Visual
                   Studio\\2022\\Community\\Common7\\IDE\\devenv.exe",
                   "state": 4294967295,
                   "isComplete": true,
                   "isLaunchable": true,
                   "isPrerelease": false,
                   "isRebootRequired": false,
                   "displayName": "Visual Studio Community 2022",
                   "description": "Powerful IDE, free for students, open-source   
                   contributors, and individuals",
                   "channelId": "VisualStudio.17.Release",
                   "channelUri": "https://aka.ms/vs/17/release/channel",
                   "enginePath": "C:\\Program Files (x86)\\Microsoft Visual       
                   Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Micros
                   oft.VisualStudio.Setup.Service",
                   "installedChannelId": "VisualStudio.17.Release",
                   "installedChannelUri": "https://aka.ms/vs/17/release/channel", 
                   "releaseNotes":
                   "https://docs.microsoft.com/en-us/visualstudio/releases/2022/re
                   lease-notes-v17.14#17.14.19",
                   "resolvedInstallationPath": "C:\\Program Files\\Microsoft      
                   Visual Studio\\2022\\Community",
                   "thirdPartyNotices":
                   "https://go.microsoft.com/fwlink/?LinkId=661288",
                   "updateDate": "2025-11-08T11:14:49.57698Z",
                   "catalog": {
                     "buildBranch": "d17.14",
                     "buildVersion": "17.14.36623.8",
                     "id": "VisualStudio/17.14.19+36623.8",
                     "localBuild": "build-lab",
                     "manifestName": "VisualStudio",
                     "manifestType": "installer",
                     "productDisplayVersion": "17.14.19",
                     "productLine": "Dev17",
                     "productLineVersion": "2022",
                     "productMilestone": "RTW",
                     "productMilestoneIsPreRelease": "False",
                     "productName": "Visual Studio",
                     "productPatchVersion": "19",
                     "productPreReleaseMilestoneSuffix": "1.0",
                     "productSemanticVersion": "17.14.19+36623.8",
                     "requiredEngineVersion": "3.14.2086.54749"
                   },
                   "properties": {
                     "campaignId": "2030:a38bb1c2cd4e49748113568186377c45",       
                     "canceled": "0",
                     "channelManifestId":
                     "VisualStudio.17.Release/17.14.19+36623.8",
                     "includeRecommended": "1",
                     "nickname": "",
                     "setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft   
                     Visual Studio\\Installer\\setup.exe"
                   }
                 }
               ]
    [   +3 ms] executing: reg query
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0
    /v InstallationFolder
    [  +17 ms] Exit code 0 from: reg query
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0
    /v InstallationFolder
    [        ] HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft        
    SDKs\Windows\v10.0
                   InstallationFolder    REG_SZ    C:\Program Files (x86)\Windows 
                   Kits\10\
    [   +2 ms] executing:
    C:\Users\83\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l       
    [   +3 ms] Failed to get Caption and OSArchitecture from WMI:
    ProcessException: Failed to find "wmic" in the search path.
                 Command: wmic
    [  +65 ms] List of devices attached
               emulator-5554          device product:sdk_gphone16k_x86_64
               model:sdk_gphone16k_x86_64 device:emu64xa16k transport_id:2        
    [   +4 ms] C:\Users\83\AppData\Local\Android\sdk\platform-tools\adb.exe -s
    emulator-5554 shell getprop
    [  +41 ms] executing: C:\Program Files\Eclipse
    Adoptium\jdk-17.0.19.10-hotspot\bin\java --version
    [  +69 ms] Exit code 0 from: C:\Program Files\Eclipse
    Adoptium\jdk-17.0.19.10-hotspot\bin\java --version
    [        ] openjdk 17.0.19 2026-04-21
               OpenJDK Runtime Environment Temurin-17.0.19+10 (build 17.0.19+10)  
               OpenJDK 64-Bit Server VM Temurin-17.0.19+10 (build 17.0.19+10,     
               mixed mode, sharing)
    [   +5 ms] ro.hardware = ranchu
    [  +26 ms] executing:
    C:\Users\83\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l       
    [  +26 ms] List of devices attached
               emulator-5554          device product:sdk_gphone16k_x86_64
               model:sdk_gphone16k_x86_64 device:emu64xa16k transport_id:2        
    [ +868 ms] <==
    {"jsonrpc":"2.0","method":"$/progress","params":{"token":"ANALYZING","value":{
    "kind":"end"}}}
    [ +194 ms] A crash report has been written to
    
    C:\Users\83\AppData\Local\Temp\flutter_tools.dfd01b7b\widget_preview_scaffold5
                        e1a6404\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+-32601+%
    28method+not+found%29%3A+Unknown+method+%22Lsp.dart%2Fworkspace%2FgetFlutterWi
    dgetPreviews%22.
    
    [        ] To report your crash to the Flutter team, first read the guide to  
    filing a
               bug.
    [        ] https://flutter.dev/to/report-bugs
    
    [        ] Create a new GitHub issue by pasting this link into your browser   
    and
               completing the issue template. Thank you!
    [   +5 ms] No .metadata file found at
    C:\Users\83\AppData\Local\Temp\flutter_tools.dfd01b7b\widget_preview_scaffold5
    e1a6404\.metadata.
    

    Dart SDK situation

    I do not have a separate Dart SDK on my PATH — I'm using only the Dart SDK bundled with this Flutter install.

    flutter doctor -v

    C:\DEV\flutter\bin\dart
    C:\DEV\flutter\bin\dart.bat
    

    Reproduction on a clean project

    After further testing, this does not reproduce on a brand-new flutter create --template=package project — the command works fine there.

  6. Alimmzdev commented on Jun 3, 2026

    @Alimmzdev
    Author

    Update — Root cause found

    After more testing, the command actually works correctly on a clean flutter create --template=package project. So this isn't a Windows-specific bug or an SDK version mismatch.

    The real issue was my own mistake: I was running flutter widget-preview start from the package root (E:\Projects\Flutter Packages\BCM — a Flutter package, not a full app), instead of from the example/ directory where the actual app lives.

    The tool connects to DTD successfully, then calls Lsp.dart/workspace/getFlutterWidgetPreviews on a workspace that isn't set up as a widget-preview app — so it crashes with -32601 method not found. Running the same command from example/ works fine.

    Fix:

    cd "E:\Projects\Flutter Packages\BCM\example"
    flutter widget-preview start
    

    That said — while this was my mistake, it does seem like flutter widget-preview start should detect that it's being run from an invalid project context and show a clear, actionable error message (e.g. "This directory is not a Flutter app. Did you mean to run this from your example/ folder?") rather than crashing with a raw JSON-RPC error and sending a crash report to Google. The current failure mode is pretty opaque for something that could be caught early. Might be worth a separate issue or UX improvement request.

  7. Alimmzdev commented on Jun 3, 2026

    @Alimmzdev
    Author

    Sorry, I accidentally closed this issue. I'm available if you need any further information or logs to investigate.

  8. puneetkukreja98 commented on Jun 3, 2026

    @puneetkukreja98
    Contributor

    @Nullexdev Thanks for reporting the issue. I tested this on the latest master channel, and I was able to reproduce it.

    Findings:
    The error occurs specifically when running the flutter widget-preview start command directly from PowerShell. However, when opening the folder in VS Code and running the exact same command from there, everything works perfectly fine.

    LOGS:

    Creating widget preview scaffolding at: C:\Google\repro_preview_issue\.widget_preview
    Creating the Widget Preview Scaffold manifest at C:\Google\repro_preview_issue\.widget_preview\preview_manifest.json
    Launching analysis server...
    Connecting to DTD
    Connected to DTD
    Failed to retrieve widget previews from the Dart Tooling Daemon (DTD). Ensure that the analysis server is running and reachable. Details: JSON-RPC error -32601 (method not
    found): Unknown method "Lsp.dart/workspace/getFlutterWidgetPreviews".

    Steps to repro:

    1. flutter create --template=package repro_preview
    2. cd repro_preview
    3. flutter widget-preview start

    @Nullexdev could you please confirm if I followed any steps incorrectly?

  9. 2 remaining items

  10. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    workaround availableThere is a workaround available to overcome the issue
    team-toolOwned by Flutter Tool team
    on Jun 3, 2026
  11. puneetkukreja98 commented on Jun 3, 2026

    @puneetkukreja98
    Contributor

    similar issue #185657

  12. Alimmzdev commented on Jun 3, 2026

    @Alimmzdev
    Author

    @puneetkukreja98

    Yes, I can confirm your steps are correct and the issue reproduces.

    However, I also found the root cause in my case: I was running flutter widget-preview start from the package root (which is a Flutter package, not a full app). Running it from the example/ directory works correctly.

    So in my situation, the crash happens when running the command from a directory that isn't a Flutter app. It seems the tool doesn't validate the project type before attempting to connect — it just crashes with a raw JSON-RPC error instead of giving a helpful message like "This directory is not a Flutter app."

    I tested from Git Bash, PowerShell, and the VS Code terminal, running the command from the example/ directory — the same error occurs regardless of where I run it from.

  13. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jun 3, 2026
  14. added
    P2Important issues not at the top of the work list
    triaged-toolTriaged by Flutter Tool team
    on Jun 12, 2026
  15. self-assigned this
    on Jun 12, 2026
  16. ThomasDuffinMears commented on Jun 18, 2026

    @ThomasDuffinMears

    Feels related to the limitation mentioned here (linked in the docs): #173550.

    We have a monorepo setup like so 👇

    .
    └── workspaceRoot
        ├── apps
        │   ├── app1
        │   │   └── lib/main.dart
        │   └── ...
        ├── packages
        │   └── ...
        └── scripts
            └── ...

    Which explains why running

    flutter widget-preview start fails with the same error.

    Notably, running

    cd ~/workspaceRoot/apps/app1 && flutter widget-preview start also fails. I wonder if that's because the IDE's context is set to ~/workspaceRoot regardless of the context of the terminal?

    EDIT: Even setting up a new workspace for the app on its own doesn't fix it. Even tried running flutter clean etc and killing the processes.

  17. github-actions commented on Jul 14, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  18. locked as resolved and limited conversation to collaborators on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool teamworkaround availableThere is a workaround available to overcome the issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions