You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[widget-preview] Command and file-watching stream crash when DTD connection is lost or fails at startup #187322
The flutter widget-preview start command and its associated file-watching stream crash with unhandled exceptions (RpcException or StateError) if the connection to the Dart Tooling Daemon (DTD) fails during startup or is unexpectedly closed during a session.
Steps to Reproduce
Scenario A: DTD failure at startup
Run flutter widget-preview start in a project.
Ensure that the Dart Tooling Daemon (DTD) is either not running, unreachable, or fails to respond to the initial getFlutterWidgetPreviews call.
The tool crashes with an unhandled RpcException or StateError bubble-up, showing a full stack trace.
Scenario B: DTD connection loss during active session
Run flutter widget-preview start and ensure it starts successfully.
While the tool is running and actively watching files, simulate a DTD connection loss (e.g., by terminating the DTD process).
The file-watching stream crashes due to an unhandled StateError or Exception when attempting to communicate with DTD, terminating the widget-preview session abruptly.
Expected Behavior
Startup: If DTD communication fails during startup, the tool should exit cleanly using throwToolExit with a user-friendly message indicating that DTD is unreachable or the analysis server is not running, rather than crashing with a stack trace.
During Session: If the DTD connection is lost while widget-preview is running, the tool should catch the connection error gracefully, log a warning to the user indicating that live updates are paused, and avoid crashing the active stream or the command.
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.
Activity
[CP-stable][Tool] Handle DTD connection failures gracefully in widget…
[CP-beta][Tool] Handle DTD connection failures gracefully in widget-p…
github-actions commentedon Jul 14, 2026
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.