Repository navigation
Description
Crash Report Details
- Signature:
FormatException at _ChunkedJsonParser.fail at dart:convert-patch/convert_patch.dart-31c7f14c - Exception:
FormatException - Volume: 245 crashes (11.7% share of Top 10 in Flutter 3.47.1)
- Error Message:
or
FormatException: Unexpected character (at character 1) Loading dynamic library failed: dlopen(/opt/homebrew/share/flutter/bin/cach... ^FormatException: Unexpected character (at character 1) Error: launching development server failed : Unable to find snapshot for th... ^
Stack Trace
_ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1466)
_ChunkedJsonParser.parseNumber / parse (dart:convert-patch/convert_patch.dart:934)
_JsonStringDecoderSink.addSlice (dart:convert-patch/convert_patch.dart:1554)
_ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:70)
_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:798)
_Socket._onData (dart:io-patch/socket_patch.dart:2906)
Context & Root Cause Analysis
During test execution or process communication (such as in flutter_platform.dart and flutter_web_platform.dart), streams and WebSocket channels expect string-encoded JSON payloads from the remote runner or test process (e.g. _pipeHarnessToRemote or BrowserManager).
When a test runner process or socket emits unformatted, non-JSON plain text error output directly over the channel (for instance, native dynamic library loading failure messages, snapshot lookup errors, or subprocess failure messages), the incoming data is passed directly into json.decode or jsonDocument (_ChunkedJsonParser). Because the payload begins with characters like L or E instead of valid JSON tokens, _ChunkedJsonParser throws an unhandled FormatException at character 1.
The unhandled FormatException crashes the Flutter CLI tool instead of being safely intercepted, logged as a warning/trace, and handled gracefully.
Proposed Fix
Safely intercept non-JSON string payloads in stream communication handlers (in flutter_platform.dart and flutter_web_platform.dart), log unexpected output to trace and warning logs, and handle test/device runner termination cleanly without crashing the tool process with an unhandled exception.
Activity
[flutter_tools] Safely handle non-JSON messages in test stream parsers (
[CP-stable][flutter_tools] Safely handle non-JSON messages in test st…
github-actions commentedon Sep 18, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.