[desktop_multi_window] Failed to send message on startup
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the desktop_multi_window startup path and reproduce the reported logs using the supplied main.dart flow, especially WindowController.fromCurrentEngine() and window creation. Trace why the Flutter engine handle is invalid when the platform message is sent. Done means startup no longer reports the invalid engine handle or failed channel message while multi-window initialization still works.
Written by the indexing model from the issue text.
Description
the app seemingly works correct, but I always have this message on startup
embedder.cc (2977): 'FlutterEngineSendPlatformMessage' returned 'kInvalidArguments'. Invalid engine handle.
2025-11-09 20:27:01.620 foilcap_app[78298:125658879] Failed to send message to Flutter engine on channel 'mixin.one/desktop_multi_window' (2).
2025-11-09 20:27:01.624 foilcap_app[78298:125658879] Running with merged UI and platform thread. Experimental.
My main.dart:
void main(List<String> args) async {
WidgetsFlutterBinding.ensureInitialized();
// Get the current window controller (for multi-window initialization)
final windowController = await WindowController.fromCurrentEngine();
print('window id: ${windowController.windowId}');
print('window args: ${windowController.arguments}');
// Parse arguments to determine window position and UUID
Offset? windowPosition;
String? windowUuid;
if (windowController.arguments.isNotEmpty) {
// This is an additional window - parse arguments
try {
final parts = windowController.arguments.split(',');
if (parts.length >= 2) {
final x = double.parse(parts[0]);
final y = double.parse(parts[1]);
windowPosition = Offset(x, y);
// If there's a third parameter - it's the UUID
if (parts.length >= 3) {
windowUuid = parts[2];
}
}
} catch (e) {
print('Error parsing window arguments: $e');
}
} else {
// This is the main window - check for temporary files
final tempFiles = await SaveLoadStore.getAllTempFiles();
if (tempFiles.isNotEmpty) {
// Use UUID from the first temporary file for the main window
final firstFile = tempFiles[0];
final fileName = firstFile.path.split('/').last;
windowUuid = fileName.replaceAll('.tmp.cap', '');
print('Main window using UUID from first temp file: $windowUuid');
// Create additional windows for remaining temporary files
await _restoreWindowsFromTempFiles();
}
}
// Initialize window manager
await windowManager.ensureInitialized();
WindowOptions windowOptions = WindowOptions(
size: const Size(800, 600),
minimumSize: const Size(640, 480),
center: windowPosition == null, // Center only if position is not specified
backgroundColor: Colors.transparent,
skipTaskbar: false,
titleBarStyle: TitleBarStyle.normal,
title: 'FoilCap',
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
// If position is specified, set it
if (windowPosition != null) {
await windowManager.setPosition(windowPosition);
}
// Enable close interception to show save dialog
await windowManager.setPreventClose(true);
await windowManager.show();
await windowManager.focus();
});
runApp(
.....
),
);
}
/// Restores windows from autosave temporary files
Future<void> _restoreWindowsFromTempFiles() async {
try {
final tempFiles = await SaveLoadStore.getAllTempFiles();
print('Found temporary files: ${tempFiles.length}');
if (tempFiles.isEmpty) {
return;
}
// Create additional windows for each temporary file (except the first one)
// The first file will be loaded in the main window automatically
for (int i = 1; i < tempFiles.length; i++) {
final file = tempFiles[i];
// Extract UUID from filename (format: {uuid}.tmp.cap)
final fileName = file.path.split('/').last;
final uuid = fileName.replaceAll('.tmp.cap', '');
final offset = 30.0 * i;
await WindowController.create(
WindowConfiguration(
hiddenAtLaunch: false,
arguments: '$offset,$offset,$uuid', // Pass position and UUID
),
);
}
} catch (e) {
print('Error restoring windows: $e');
}
}
- Dominant language
- C
- Stars
- 512
- Forks
- 292
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MixinNetwork/flutter-plugins
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
MixinNetwork/flutter-plugins#512 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
MixinNetwork/flutter-plugins#507 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
MixinNetwork/flutter-plugins#413 · 8 reactions ·
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
MixinNetwork/flutter-plugins#401 · 2 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
MixinNetwork/flutter-plugins#509 ·
All issues in MixinNetwork/flutter-plugins
Similar issues
-
bug Component component: net
Difficulty 1/5 Under an hour Newbie friendliness 90/100
RT-Thread/rt-thread#11852 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
siderolabs/pkgs#1710 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100