Repository navigation
Closed
flutter/packages
#13403Labels
has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: flutter_svgThe Flutter SVG drawing packagesThe Flutter SVG drawing packagespackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-engineOwned by Engine teamOwned by Engine team
Description
What package does this bug report belong to?
flutter_svg
What target platforms are you seeing this bug on?
Android, iOS
Have you already upgraded your packages?
Yes
Dependency versions
flutter_svg 2.3.1 (also present on current main of flutter/packages). No other dependencies are involved — the bug is in SvgNetworkLoader itself.
Steps to reproduce
- Point
SvgPicture.network(orSvgNetworkLoader) at a URL whose server answers with a non-2xx status and an HTML body, e.g. a 404 or a 503 error page. - Let the picture load.
Expected results
The load fails with an error that names the HTTP status and URL, so the cause is visible (e.g. an http.ClientException).
Actual results
SvgNetworkLoader.prepareMessage returns response.bodyBytes without checking response.statusCode, so the HTML error page is handed to the SVG parser and fails as StateError: Bad state: Invalid SVG data. The actual 404/503 is lost.
We ran into this in production: during a short backend 503 outage, a request got the server's error page, and our crash reporter showed only "Invalid SVG data".
Code sample
Code sample
// Any URL that returns 404 with an HTML body.
final bytes = await const SvgNetworkLoader('https://example.com/missing.svg')
.prepareMessage(null);
// bytes is the 404 page; parsing it later throws
// StateError: Bad state: Invalid SVG dataScreenshots or Videos
No response
Logs
Logs
StateError: Bad state: Invalid SVG data
parser.dart: SvgParser._parseTree
parser.dart: SvgParser.parse
vector_graphics_compiler.dart: parse
vector_graphics_compiler.dart: encodeSvg
loaders.dart: SvgLoader._load.<fn>.<fn>Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.44.8, on macOS 27.0.1 26A434 darwin-arm64, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
[!] Xcode - develop for iOS and macOS (Xcode 27.0)
[✓] Chrome - develop for the web
[✓] Connected device (3 available)
[✓] Network resourcesReacted by elesnikova757-blip
Metadata
Metadata
Assignees
Labels
has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: flutter_svgThe Flutter SVG drawing packagesThe Flutter SVG drawing packagespackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-engineOwned by Engine teamOwned by Engine team
Activity
mbcorona commentedon Oct 23, 2026
HI @francisrath , thanks for the report.
Routing to the engine team to evaluate the issue and PR.
[flutter_svg] Throw on non-2xx responses in SvgNetworkLoader (#13403)
github-actions commentedon Nov 11, 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.