When a project depends on the Flutter SDK package flutter_gpu, running flutter create to add a platform crashes after the files are generated. The new platform files are created correctly, but the command then exits with a crash, so it looks like the command failed.
This affects any package that uses Flutter GPU and therefore depends on flutter_gpu (for example, the flutter_scene rendering package). Adding a platform to an existing project is the common way to hit it. The specific platform does not matter (the crash happens before any platform-specific work), but Linux is used below as a concrete example.
Steps to reproduce
- Create a new app without the Linux platform:
flutter create myapp --platforms=android
cd myapp
- Add a dependency on the SDK package
flutter_gpu to pubspec.yaml:
dependencies:
flutter:
sdk: flutter
flutter_gpu:
sdk: flutter
- Run
flutter pub get. This succeeds.
- Add the Linux platform:
flutter create . --platforms=linux
Note: this is not specific to my fork. flutter_gpu lives in bin/cache/pkg on the standard master channel too, so the same code path fails there.
Expected results
The Linux platform is added and the command finishes without error, the same way it does for a project that does not depend on flutter_gpu.
Actual results
The platform files are generated, but the command then crashes:
Oops; flutter has exited unexpectedly: "PathNotFoundException: Cannot open file, path = '.../packages/flutter_gpu/pubspec.yaml' (OS Error: No such file or directory, errno = 2)".
In plain terms: at the end of flutter create, the tool reads the pubspec.yaml of each SDK package the project depends on so it can pin their versions. It looks for them in <flutter_sdk>/packages/<name>/. That is correct for most SDK packages, but flutter_gpu (like sky_engine) actually lives in <flutter_sdk>/bin/cache/pkg/<name>/. The file is not found at the assumed location, so the whole command crashes.
The failing code is gatherSdkPackageDependencies in packages/flutter_tools/lib/src/commands/create.dart. It builds the path as fs.path.join(flutterRoot, 'packages', sdkPackage, 'pubspec.yaml') and does not account for SDK packages that live under bin/cache/pkg/.
Code sample
No Dart code is needed to reproduce this. The minimal sample is the pubspec plus the command.
Code sample
# pubspec.yaml
name: myapp
environment:
sdk: ^3.10.0
dependencies:
flutter:
sdk: flutter
flutter_gpu:
sdk: flutter
flutter create . --platforms=linux
Screenshots or Video
Screenshots / Video demonstration
Not applicable (command line crash).
Logs
Logs
[ +3 ms] Oops; flutter has exited unexpectedly: "PathNotFoundException: Cannot open file, path = '/Users/bdero/projects/flutter/flutter/packages/flutter_gpu/pubspec.yaml' (OS Error: No such file or directory, errno = 2)".
#4 ForwardingFile.readAsStringSync (package:file/src/forwarding/forwarding_file.dart:99:16)
#5 ErrorHandlingFile.readAsStringSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_io.dart:212:22)
#6 _runSync (package:flutter_tools/src/base/error_handling_io.dart:552:14)
#7 ErrorHandlingFile.readAsStringSync (package:flutter_tools/src/base/error_handling_io.dart:211:12)
#8 gatherSdkPackageDependencies (package:flutter_tools/src/commands/create.dart:1410:20)
#9 _generatePubspecLock (package:flutter_tools/src/commands/create.dart:1374:27)
#10 CreateCommand.runCommand (package:flutter_tools/src/commands/create.dart:550:5)
<asynchronous suspension>
Flutter Doctor output
Doctor output
[!] Flutter (Channel [user-branch], 3.45.0-1.0.pre-330, on macOS 15.5 24F74 darwin-arm64, locale en-US)
! Flutter version 3.45.0-1.0.pre-330 on channel [user-branch] at /Users/bdero/projects/flutter/flutter
Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
• Framework revision f4f991b59c (9 days ago), 2026-05-28 23:39:56 -0700
• Engine revision 22c17bfc90
• Dart version 3.13.0 (build 3.13.0-158.0.dev)
• DevTools version 2.58.0
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.4)
[✓] Chrome - develop for the web
[✓] Connected device (3 available)
[✓] Network resources
! Doctor found issues in 1 category.
When a project depends on the Flutter SDK package
flutter_gpu, runningflutter createto add a platform crashes after the files are generated. The new platform files are created correctly, but the command then exits with a crash, so it looks like the command failed.This affects any package that uses Flutter GPU and therefore depends on
flutter_gpu(for example, theflutter_scenerendering package). Adding a platform to an existing project is the common way to hit it. The specific platform does not matter (the crash happens before any platform-specific work), but Linux is used below as a concrete example.Steps to reproduce
flutter create myapp --platforms=android cd myappflutter_gputopubspec.yaml:flutter pub get. This succeeds.flutter create . --platforms=linuxNote: this is not specific to my fork.
flutter_gpulives inbin/cache/pkgon the standard master channel too, so the same code path fails there.Expected results
The Linux platform is added and the command finishes without error, the same way it does for a project that does not depend on
flutter_gpu.Actual results
The platform files are generated, but the command then crashes:
In plain terms: at the end of
flutter create, the tool reads thepubspec.yamlof each SDK package the project depends on so it can pin their versions. It looks for them in<flutter_sdk>/packages/<name>/. That is correct for most SDK packages, butflutter_gpu(likesky_engine) actually lives in<flutter_sdk>/bin/cache/pkg/<name>/. The file is not found at the assumed location, so the whole command crashes.The failing code is
gatherSdkPackageDependenciesinpackages/flutter_tools/lib/src/commands/create.dart. It builds the path asfs.path.join(flutterRoot, 'packages', sdkPackage, 'pubspec.yaml')and does not account for SDK packages that live underbin/cache/pkg/.Code sample
No Dart code is needed to reproduce this. The minimal sample is the pubspec plus the command.
Code sample
flutter create . --platforms=linuxScreenshots or Video
Screenshots / Video demonstration
Not applicable (command line crash).
Logs
Logs
Flutter Doctor output
Doctor output