Steps to Reproduce
A glob entry in the workspace: block of a host app's pubspec.yaml (e.g. - packages/*) is enough — no native-asset / firebase / objective_c / sentry / etc. dependencies needed.
mkdir repro && cd repro
flutter create .
flutter create --template=package packages/some_pkg
Edit repro/pubspec.yaml and add:
Edit repro/packages/some_pkg/pubspec.yaml and add under environment::
Then run:
Expected results
flutter test --coverage exits 0 and writes coverage/lcov.info.
Actual results
The test process exits successfully, then flutter crashes with a RangeError and coverage/lcov.info is never written. Exit code is non-zero, so CI fails even though every test passed.
00:00 +1: All tests passed!
Oops; flutter has exited unexpectedly: "RangeError (length): Invalid value: Valid value range is empty: 0".
#0 _Array.[] (dart:core-patch/array.dart)
#1 Resolver.resolve (package:coverage/src/resolver.dart:85:43)
#2 CoverageCollector.finalizeCoverage.<anonymous closure> (package:flutter_tools/src/test/coverage_collector.dart:216:44)
#3 MappedIterator.moveNext (dart:_internal/iterable.dart:420:20)
#4 WhereTypeIterator.moveNext (dart:_internal/iterable.dart:904:20)
#5 new _GrowableList._ofOther (dart:core-patch/growable_array.dart:207:26)
#6 new _GrowableList.of (dart:core-patch/growable_array.dart:156:26)
#7 new List.of (dart:core-patch/array_patch.dart:39:18)
#8 Iterable.toList (dart:core/iterable.dart:517:7)
#9 CoverageCollector.finalizeCoverage (package:flutter_tools/src/test/coverage_collector.dart:218:12)
#10 CoverageCollector.collectCoverageData (package:flutter_tools/src/test/coverage_collector.dart:235:40)
#11 TestCommand.runCommand (package:flutter_tools/src/commands/test.dart:713:53)
Trigger chain
FlutterProject.workspaceProjects doesn't expand glob entries — it produces a synthetic FlutterProject for the literal path packages/*, which doesn't exist as a real directory and therefore has no pubspec.yaml, so manifest.appName returns the empty string.
_getCoveragePackages in packages/flutter_tools/lib/src/commands/test.dart walks flutterProject.workspaceProjects recursively and calls packagesToInclude.add(project.manifest.appName). The empty-name synthetic project contributes "" to the set.
CoverageCollector.finalizeCoverage (packages/flutter_tools/lib/src/test/coverage_collector.dart:216) builds package:$e for each entry. With e = "", that's the bare URI package:.
Resolver.resolve (package:coverage/src/resolver.dart:85) does uri.pathSegments[0] on that URI, where pathSegments is empty → RangeError.
Confirmed by patching the local SDK to log:
!!! addProject name=<host_app> dir=/.../repro
!!! addProject name=<> dir=/.../repro/packages/*
!!! libraryNames = <host_app>, <>
The dir=/.../packages/* is the synthetic project — Flutter is treating the glob as a literal directory.
What sidesteps the crash
- Replacing the glob with an explicit list of workspace members in
workspace: (e.g. - packages/some_pkg instead of - packages/*). flutter test --coverage then runs cleanly.
- Passing
--coverage-package=<host_package_name> (limits coverage collection to the host package, so the empty entry never reaches the resolver — but loses workspace-package coverage).
Logs / flutter doctor -v
flutter doctor -v
[✓] Flutter (Channel stable, 3.41.7, on macOS 26.4.1 25E253 darwin-arm64, locale en-AR)
• Flutter version 3.41.7 on channel stable
• Framework revision cc0734ac71 (12 days ago), 2026-04-15 21:21:08 -0700
• Engine revision 59aa584fdf
• Dart version 3.11.5
• DevTools version 2.54.2
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop,
enable-windows-desktop, enable-android, enable-ios, cli-animations,
enable-native-assets, omit-legacy-version-file, enable-lldb-debugging,
enable-uiscene-migration
[✓] Xcode - develop for iOS and macOS (Xcode 26.4.1)
[✓] Chrome - develop for the web
[✓] Connected device (3 available)
[✓] Network resources
Steps to Reproduce
A glob entry in the
workspace:block of a host app'spubspec.yaml(e.g.- packages/*) is enough — no native-asset / firebase / objective_c / sentry / etc. dependencies needed.Edit
repro/pubspec.yamland add:Edit
repro/packages/some_pkg/pubspec.yamland add underenvironment::Then run:
flutter test --coverageExpected results
flutter test --coverageexits 0 and writescoverage/lcov.info.Actual results
The test process exits successfully, then
fluttercrashes with aRangeErrorandcoverage/lcov.infois never written. Exit code is non-zero, so CI fails even though every test passed.Trigger chain
FlutterProject.workspaceProjectsdoesn't expand glob entries — it produces a syntheticFlutterProjectfor the literal pathpackages/*, which doesn't exist as a real directory and therefore has nopubspec.yaml, somanifest.appNamereturns the empty string._getCoveragePackagesinpackages/flutter_tools/lib/src/commands/test.dartwalksflutterProject.workspaceProjectsrecursively and callspackagesToInclude.add(project.manifest.appName). The empty-name synthetic project contributes""to the set.CoverageCollector.finalizeCoverage(packages/flutter_tools/lib/src/test/coverage_collector.dart:216) buildspackage:$efor each entry. Withe = "", that's the bare URIpackage:.Resolver.resolve(package:coverage/src/resolver.dart:85) doesuri.pathSegments[0]on that URI, wherepathSegmentsis empty →RangeError.Confirmed by patching the local SDK to log:
The
dir=/.../packages/*is the synthetic project — Flutter is treating the glob as a literal directory.What sidesteps the crash
workspace:(e.g.- packages/some_pkginstead of- packages/*).flutter test --coveragethen runs cleanly.--coverage-package=<host_package_name>(limits coverage collection to the host package, so the empty entry never reaches the resolver — but loses workspace-package coverage).Logs /
flutter doctor -vflutter doctor -v