Skip to content

Widget Preview terminates with "is not a valid Flutter project" for valid Flutter project #178052

@DanTup

Description

@DanTup

Steps to reproduce

I cloned the flutter/packages repo and opened it in VS Code, and got a notification that the widget preview server terminated. In the logs I found:

[4:04:03 PM] [FlutterWidgetPreview] [Info] <== [{"event":"widget_preview.logMessage","params":{"level":"error","message":"D:\\Dev\\Google\\Flutter\\packages\\packages\\animations is not a valid Flutter project."}}]
[4:04:03 PM] [FlutterWidgetPreview] [Info] Process D:\Dev\Google\Flutter\Flutter main\bin\flutter.bat terminated! 1, null

It certainly looks like a valid Flutter project to me. My guess is that this might be because I haven't yet run pub get for this package, and therefore there are bits missing. However, since this is not an uncommon case, I think it needs to be handled (ideally in the tool here, to avoid IDEs having to do this kind of detailed tracking of the state of the Flutter projects).

cc @bkonyi

Expected results

The preview server should start up and just provide no widget previews (and pick up the previews once the project becomes in a state where this is possible).

Actual results

The server terminates with an error.

Code sample

Code sample

N/A

Screenshots or Video

Screenshots / Video demonstration

N/A

Logs

Logs
Wed Nov 05 2025 [16:04:01 GMT+0000 (Greenwich Mean Time)] Log file started
[4:04:02 PM] [FlutterWidgetPreview] [Info] Spawning D:\Dev\Google\Flutter\Flutter main\bin\flutter.bat with args ["widget-preview","start","--machine","--web-server","--dtd-url","ws://127.0.0.1:52532/CsKolHD-nZg=","--devtools-server-address","http://127.0.0.1:9100/"]
[4:04:02 PM] [FlutterWidgetPreview] [Info] ..  in D:\Dev\Google\Flutter\packages\packages\animations
[4:04:02 PM] [FlutterWidgetPreview] [Info] ..  with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code","FLUTTER_ROOT":"D:\\Dev\\Google\\Flutter\\Flutter main"}}
[4:04:02 PM] [FlutterWidgetPreview] [Info]     PID: 22732
[4:04:03 PM] [FlutterWidgetPreview] [Info] <== [{"event":"widget_preview.initializing","params":{"pid":13596}}]
[4:04:03 PM] [FlutterWidgetPreview] [Info] <== [{"event":"widget_preview.logMessage","params":{"level":"error","message":"D:\\Dev\\Google\\Flutter\\packages\\packages\\animations is not a valid Flutter project."}}]
[4:04:03 PM] [FlutterWidgetPreview] [Info] Process D:\Dev\Google\Flutter\Flutter main\bin\flutter.bat terminated! 1, null
[4:04:03 PM] [General] [Error] Failed to set up Widget Preview: Widget Preview server process terminated

Flutter Doctor output

Doctor output
PS D:\Dev\Google\Flutter\packages\packages\animations> flutter doctor -v
[!] Flutter (Channel master, 3.38.0-1.0.pre-38, on Microsoft Windows [Version 10.0.26100.6899], locale en-GB) [3.3s]
    • Flutter version 3.38.0-1.0.pre-38 on channel master at D:\Dev\Google\Flutter\Flutter main
    ! 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.
    ! 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.
    • Framework revision 498545a341 (4 weeks ago), 2025-10-09 17:34:03 -0500
    • Engine revision d64282028b
    • Dart version 3.11.0 (build 3.11.0-8.0.dev)
    • DevTools version 2.51.0
    • 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
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and
      upgrades.

[✓] Windows Version (11 Pro 64-bit, 24H2, 2009) [652ms]

[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [2.1s]
    • Android SDK at C:\Users\danny\AppData\Local\Android\sdk
    • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
    • Platform android-36, build-tools 35.0.0
    • 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"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✓] Chrome - develop for the web [54ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

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

[✓] Connected device (3 available) [105ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26100.6899]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 142.0.7444.60
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 141.0.3537.92

[✓] Network resources [269ms]
    • All expected network resources are available.

! Doctor found issues in 2 categories.
PS D:\Dev\Google\Flutter\packages\packages\animations>

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: widget previewsIssues related to the Widget Previewer toolingc: crashStack traces logged to the consolefound in release: 3.35Found to occur in 3.35found in release: 3.38Found to occur in 3.38has 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