Skip to content

[widget-preview] Command and file-watching stream crash when DTD connection is lost or fails at startup #187322

Closed

Description

@bkonyi

Summary

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

  1. Run flutter widget-preview start in a project.
  2. Ensure that the Dart Tooling Daemon (DTD) is either not running, unreachable, or fails to respond to the initial getFlutterWidgetPreviews call.
  3. The tool crashes with an unhandled RpcException or StateError bubble-up, showing a full stack trace.

Scenario B: DTD connection loss during active session

  1. Run flutter widget-preview start and ensure it starts successfully.
  2. While the tool is running and actively watching files, simulate a DTD connection loss (e.g., by terminating the DTD process).
  3. 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.

Activity

  1. self-assigned this
    on May 29, 2026
  2. added
    P2Important issues not at the top of the work list
    team-toolOwned by Flutter Tool team
    triaged-toolTriaged by Flutter Tool team
    on May 29, 2026
  3. 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.

  4. 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 teamtriaged-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