pub icon indicating copy to clipboard operation
pub copied to clipboard

Frequent instances of "Could not find a file named "pubspec.yaml"" when running `dart pub deps --json`

Open bkonyi opened this issue 11 months ago • 3 comments

The top crashers on the Flutter beta channel right now are mostly all related to failures to find the pubspec.yaml within packages in the cache:

Thread 0 main threadStateError: Bad state: /flutter/bin/cache/dart-sdk/bin/dart pub --suppress-analytics deps --json failed
Could not find a file named "pubspec.yaml" in "/root/.pub-cache/hosted/pub.dev/characters-1.4.0".
at _DefaultPub.deps.fail	(pub.dart:370)
at _DefaultPub.deps	(pub.dart:378)
at <asynchronous gap>	(async)
at computeExclusiveDevDependencies	(compute_dev_dependencies.dart:21)
at <asynchronous gap>	(async)
at findPlugins	(flutter_plugins.dart:105)
at <asynchronous gap>	(async)
at refreshPluginsList	(flutter_plugins.dart:1109)
at <asynchronous gap>	(async)
at FlutterProject.ensureReadyForPlatformSpecificTooling	(project.dart:369)
at <asynchronous gap>	(async)
at FlutterCommand.regeneratePlatformSpecificToolingIfApplicable	(flutter_command.dart:1931)
at <asynchronous gap>	(async)
at FlutterCommand.verifyThenRunCommand	(flutter_command.dart:1887)
at <asynchronous gap>	(async)
at FlutterCommand.run.<anonymous closure>	(flutter_command.dart:1553)
at <asynchronous gap>	(async)
at AppContext.run.<anonymous closure>	(context.dart:154)
at <asynchronous gap>	(async)
at CommandRunner.runCommand	(command_runner.dart:212)
at <asynchronous gap>	(async)
at FlutterCommandRunner.runCommand.<anonymous closure>	(flutter_command_runner.dart:494)
at <asynchronous gap>	(async)
at AppContext.run.<anonymous closure>	(context.dart:154)
at <asynchronous gap>	(async)
at FlutterCommandRunner.runCommand	(flutter_command_runner.dart:431)
at <asynchronous gap>	(async)
at run.<anonymous closure>.<anonymous closure>	(runner.dart:98)
at <asynchronous gap>	(async)
at AppContext.run.<anonymous closure>	(context.dart:154)
at <asynchronous gap>	(async)
at main	(executable.dart:102)
at <asynchronous gap>	(async)

This issue is also present on the stable branch, but seems to be much less frequent.

It's unclear why this is happening, but it's worrying that we're seeing this from 100-200 unique users on the beta channel which only has a few hundred users on average.

FYI @sigurdm @jonasfj

bkonyi avatar Apr 08 '25 16:04 bkonyi

@sigurdm is it possible we changed something in dart pub deps?

jonasfj avatar Apr 08 '25 17:04 jonasfj

Or maybe around ensureUpToDate/assertUpToDate where we no longer check if the YAML file actually exist?

jonasfj avatar Apr 08 '25 17:04 jonasfj

I don't think we changed anything in pub deps recently.

Is this a difference between beta and stable? Not sure why something would change here.

pub deps should perhaps do ensureResolved but it is also a question why flutter_tools ends up calculating deps without first running pub get...

sigurdm avatar Apr 14 '25 13:04 sigurdm