Skip to content

[flutter_tools] Unhandled ArgumentError in TestCommand._parseTestArgument when path contains Windows reserved characters #191896

Closed

Description

@bkonyi

Crash Report Details

  • Signature: ArgumentError at _Uri._checkWindowsPathReservedCharacters at dart:core/uri.dart-16ba610a
  • Exception: ArgumentError
  • Volume: 259 crashes (12.3% share of Top 10 in Flutter 3.47.1 stable)
  • Error Message: Invalid argument(s): Illegal character in path

Stack Trace

_Uri._checkWindowsPathReservedCharacters (dart:core/uri.dart:2169)
_Uri._makeWindowsFileUrl (dart:core/uri.dart:2242)
new _Uri.file (dart:core/uri.dart:2132)
TestCommand._parseTestArgument (package:flutter_tools/src/commands/test.dart:791)
TestCommand.verifyThenRunCommand (package:flutter_tools/src/commands/test.dart:362)

Description & Root Cause

When running flutter test on Windows (or when target arguments are formatted with Windows paths), TestCommand._parseTestArgument parses target path arguments by calling Uri.file(filePart).
On Windows, Uri.file invokes _Uri._checkWindowsPathReservedCharacters, which disallows wildcard / glob characters (*, ?), redirection characters (<, >, |), quotes ("), or malformed colons. If a user specifies a glob or pattern that is not expanded by their shell (common on Windows cmd.exe or PowerShell, e.g. flutter test test/*_test.dart), Uri.file throws an ArgumentError: Invalid argument(s): Illegal character in path.

Because _parseTestArgument does not catch ArgumentError, the exception is unhandled and causes flutter_tools to crash with an unhandled tool crash report instead of exiting cleanly with a user-friendly ToolExit.

Reproduction

On Windows (or with Windows path parsing in tests), run:

flutter test "test/*_test.dart"

Actual Result:
Crash with ArgumentError: Invalid argument(s): Illegal character in path.

Expected Result:
Clean exit with ToolExit reporting invalid test path/target syntax.

Activity

  1. added
    c: crashStack traces logged to the console
    platform-windowsBuilding on or for Windows 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 27, 2026
  2. self-assigned this
    on Aug 27, 2026
  3. added a commit that references this issue on Sep 25, 2026
    cd6955d
  4. added 2 commits that reference this issue on Sep 28, 2026
    e447022
    ee24cfc
  5. github-actions commented on Oct 9, 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.

  6. locked as resolved and limited conversation to collaborators on Oct 9, 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-windowsBuilding on or for Windows specificallyt: top-crasherteam-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