Skip to content

[flutter_tools] Catch exceptions when starting Chrome to launch DevTools - #191215

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
bkonyi:issue-182307
Aug 18, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
bkonyi:issue-182307

Conversation

@bkonyi

@bkonyi bkonyi commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Description

If Google Chrome is not installed, attempting to launch DevTools throws a ProcessException from Chrome.start. Because this call was unawaited and unhandled, it caused the flutter tool to crash.

This change wraps the startChrome invocation in a try-catch block to gracefully catch Exceptions and log the error message via logger.printError instead of crashing.

Related Issues

Fixes #182307

Tests

  • Added regression test launchDevToolsInBrowser handles startChrome failure in packages/flutter_tools/test/general.shard/proxied_devices/proxied_devices_test.dart.

If Google Chrome is not installed, attempting to launch DevTools throws a ProcessException from Chrome.start. Because this call was unawaited and unhandled, it caused the flutter tool to crash.

Fixes: flutter#182307
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 17, 2026
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 17, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request wraps the browser-launching logic in a try-catch block to handle and log exceptions when startChrome fails, and adds a unit test to verify this behavior. The review feedback suggests refactoring the immediately invoked asynchronous function expression (IIFE) into a named local helper function to improve code readability.

@bkonyi
bkonyi requested a review from chingjun August 17, 2026 17:38
@bkonyi bkonyi added CICD Run CI/CD and removed CICD Run CI/CD labels Aug 17, 2026
@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 18, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 18, 2026
Merged via the queue into flutter:master with commit 7c08f43 Aug 18, 2026
28 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tool_crash] Opening devtools without Chrome installed crashes flutter tool

2 participants