Skip to content

[tool_crash] Unhandled SessionNotCreatedException in WebDriverService.startTest during flutter drive #193517

Closed

Description

@bkonyi

Summary

In Flutter 3.47.5 (7 days post-release), SessionNotCreatedException at parseW3cResponse (package:webdriver/src/handler/w3c/utils.dart-9abe6b17) is the #6 tool crasher, accounting for 112 crashes (7.3% of Top 10 crashes, 3.7% of all crashes) during flutter drive.

Stack Trace & Error Message

SessionNotCreatedException (500): session not created: DevToolsActivePort file doesn't exist

(Also observed with Safari WebDriver timeouts: SessionNotCreatedException (500): Could not create a session: The session timed out while connecting to a Safari instance.)

#0      parseW3cResponse (package:webdriver/src/handler/w3c/utils.dart:81)
#1      W3cSessionHandler.parseCreateResponse (package:webdriver/src/handler/w3c/session.dart:19)
#2      InferSessionHandler.parseCreateResponse (package:webdriver/src/handler/infer_handler.dart:106)
#3      AsyncRequestClient.send (package:webdriver/src/common/request_client.dart:96)
<asynchronous suspension>
#4      createDriver (package:webdriver/async_core.dart:62)
<asynchronous suspension>
#5      WebDriverService.startTest (package:flutter_tools/src/drive/web_driver_service.dart:200)
<asynchronous suspension>
#6      DriveCommand.runCommand (package:flutter_tools/src/commands/drive.dart:387)

Root Cause Analysis

In WebDriverService.startTest (packages/flutter_tools/lib/src/drive/web_driver_service.dart:199-219), async_io.createDriver(...) only catches SocketException:

    try {
      webDriver = await async_io.createDriver(
        uri: Uri.parse('http://localhost:$driverPort/'),
        desired: getDesiredCapabilities(...),
      );
    } on SocketException catch (error) {
      _logger.printTrace('$error');
      throwToolExit(
        'Unable to start a WebDriver session for web testing.\n'
        'Make sure you have the correct WebDriver server (e.g. chromedriver) running at $driverPort.\n'
        'For instructions on how to obtain and run a WebDriver server, see:\n'
        'https://flutter.dev/to/integration-test-on-web\n',
      );
    }

When the WebDriver server (chromedriver, safaridriver, geckodriver) is reachable over TCP but fails to launch or connect to the browser instance (e.g., Chrome crashes on launch without --no-sandbox / DevToolsActivePort file doesn't exist, browser/driver version mismatch, or Safari automation session timeout), package:webdriver throws WebDriverException (SessionNotCreatedException), which escapes uncaught as a tool crash.

Expected Behavior

WebDriverService.startTest should catch async_io.WebDriverException (or SessionNotCreatedException) and call throwToolExit with the underlying WebDriver error message rather than crashing flutter_tools.

Related Issues & PRs

Activity

  1. added
    c: crashStack traces logged to the console
    P1High-priority issues at the top of the work list
    team-toolOwned by Flutter Tool team
    toolAffects the "flutter" command-line tool. See also t: labels.
    triaged-toolTriaged by Flutter Tool team
    on Sep 29, 2026
  2. github-actions commented on Nov 4, 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.

  3. locked as resolved and limited conversation to collaborators on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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.47t: top-crasherteam-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