Skip to content

[flutter_tools] Unhandled DartDevelopmentServiceException when WebSocket upgrade fails during DDS startup in ResidentWebRunner #191179

Closed

Description

@bkonyi

Summary

In Flutter 3.47.0 telemetry, an unhandled DartDevelopmentServiceException during web debugging startup emerged as a top crash signature.

When DDS fails to upgrade its WebSocket connection to DWDS (e.g., due to early browser termination or socket closure), package:dds throws DartDevelopmentServiceException with error code connectionError (Code 3). Because ResidentWebRunner.run() only handled failedToStartError and re-threw other error codes, the exception escaped unhandled and crashed the tool.

Telemetry Profile

  • Release: Flutter 3.47.0 (Top 10 crasher)
  • Signature: DartDevelopmentServiceException-53f282da

Error Output

DartDevelopmentServiceException: WebSocketChannelException: WebSocketException: Connection to 'http://127.0.0.1:62932/9fVOXxsamo0=/ws#' was not upgraded to websocket

Root Cause

In packages/flutter_tools/lib/src/isolated/resident_web_runner.dart, the on DartDevelopmentServiceException handler checked:

if (error.errorCode == DartDevelopmentServiceException.failedToStartError) {
  throwToolExit(kExitMessage);
}
rethrow;

When WebSocket upgrade failed, package:dds threw DartDevelopmentServiceException.connectionIssue() with errorCode == DartDevelopmentServiceException.connectionError (3). The condition evaluated to false, hitting rethrow; and crashing the tool.

Proposed Fix

Update on DartDevelopmentServiceException in ResidentWebRunner.run() to catch all DDS exception variants, log error diagnostics with stack trace, call appFailedToStart(), and gracefully exit via throwToolExit(kExitMessage) without rethrowing.

Activity

  1. added
    c: crashStack traces logged to the console
    toolAffects the "flutter" command-line tool. See also t: labels.
    platform-webWeb applications specifically
    team-toolOwned by Flutter Tool team
    P1High-priority issues at the top of the work list
    triaged-toolTriaged by Flutter Tool team
    on Aug 16, 2026
  2. self-assigned this
    on Aug 16, 2026
  3. github-actions commented on Sep 1, 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 Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listc: crashStack traces logged to the consolefound in release: 3.47Found to occur in 3.47platform-webWeb applications specificallyteam-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