Repository navigation
Widget Preview terminates with "is not a valid Flutter project" for valid Flutter project #178052
Copy link
Copy link
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: widget previewsIssues related to the Widget Previewer toolingIssues related to the Widget Previewer toolingc: crashStack traces logged to the consoleStack traces logged to the consolefound in release: 3.35Found to occur in 3.35Found to occur in 3.35found in release: 3.38Found to occur in 3.38Found to occur in 3.38has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Description
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 terminatedFlutter 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 [email protected]:DanTup/flutter.git is not a standard remote.
Set environment variable "FLUTTER_GIT_URL" to [email protected]: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>Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: widget previewsIssues related to the Widget Previewer toolingIssues related to the Widget Previewer toolingc: crashStack traces logged to the consoleStack traces logged to the consolefound in release: 3.35Found to occur in 3.35Found to occur in 3.35found in release: 3.38Found to occur in 3.38Found to occur in 3.38has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Activity
tirth-patel-nc commentedon Nov 6, 2025
@DanTup thanks for the report. I noticed this while switching flutter versions in VSCode.
Screen.Recording.2025-11-06.at.3.32.25.PM.mov
DanTup commentedon Nov 6, 2025
@tirth-patel-nc thanks - the second issue you hit ("already registered") looks like a bug in Dart-Code - I've filed Dart-Code/Dart-Code#5782 for that one. Thanks!
bkonyi commentedon Nov 6, 2025
Good catch @DanTup! I think this check can actually just be removed. It shouldn't matter if there's a
.dart_tooldirectory or ifpub gethasn't been run since thewidget_preview_scaffoldproject will havepub getrun when we launch the previewer.I'll upload a fix and CP this.
3 remaining items
DanTup commentedon Nov 11, 2025
@bkonyi thanks! Do you still intend to cherry-pick?
[ Widget Preview ] Don't require 'flutter pub get' to be run in the r…
[ Widget Preview ] Don't require 'flutter pub get' to be run in the r…
[ Widget Preview ] Don't require 'flutter pub get' to be run in the r…
[CP-stable][ Widget Preview ] Don't require 'flutter pub get' to be r…
[CP-beta][ Widget Preview ] Don't require 'flutter pub get' to be run…
tirth-patel-nc commentedon Nov 21, 2025
Screen.Recording.2025-11-21.at.5.17.53.PM.mov
Issue is still present on latest master 3.39.0-1.0.pre-227. cc: @huycozy
DanTup commentedon Nov 21, 2025
@tirth-patel-nc looking at the video, I think you're seeing Dart-Code/Dart-Code#5782 and not the issue fixed here?
A fix for that is currently live in the pre-release version of the Dart VS Code extension and will be included in the stable release at the end of the month.
[ Widget Preview ] Don't require 'flutter pub get' to be run in the r…
[ Widget Preview ] Don't require 'flutter pub get' to be run in the r…
github-actions commentedon Dec 10, 2025
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 -vand a minimal reproduction of the issue.[ Widget Preview ] Don't require 'flutter pub get' to be run in the r…
[ Widget Preview ] Don't require 'flutter pub get' to be run in the r…