Why does dart run flutter_oss_licenses:generate fail with PathNotFoundException for '/programs/flutter/version'?
Last updated: August 8, 2026
Context
When running dart run flutter_oss_licenses:generate as part of a build workflow (e.g., in a pre-build script), the command fails with the following error:
PathNotFoundException: Cannot open file, path = '/Users/builder/programs/flutter/version' (OS Error: No such file or directory, errno = 2)This error occurs even if the command previously worked without any changes to the project's dependencies.
Answer
This is a project-side issue caused by an outdated version of the dart_pubspec_licenses package. Specifically, versions of dart_pubspec_licenses prior to 3.0.14 attempt to read Flutter version information from a version file that no longer exists in newer Flutter installations. This file was replaced by bin/cache/flutter.version.json, and the fix was introduced in dart_pubspec_licenses 3.0.14.
To resolve this issue, update your flutter_oss_licenses and/or dart_pubspec_licenses dependencies so that dart_pubspec_licenses resolves to at least version 3.0.14:
Open your project's
pubspec.yamlfile.Update the
flutter_oss_licensesdependency to a version that pulls indart_pubspec_licenses 3.0.14or higher.Run
flutter pub upgradeto update yourpubspec.lockfile.Commit the updated
pubspec.lockto your repository.Re-run your build workflow.
For more details on the underlying fix, refer to the related issue on GitHub.