Description
Steps to reproduce
Steps to reproduce
Run any Flutter CLI command such as:
flutter --versionin a network environment where the Azure metadata request results in an unexpected exception.
Expected behavior
Azure metadata detection is a best-effort environment check. Any failure should be treated as "not running on Azure", and the Flutter CLI should continue normally.
Actual results
Actual behavior
The unexpected exception propagates and terminates the Flutter CLI.
Example:
Unhandled exception:
Invalid argument(s): No host specified in URI http:///e2gerror.php?...
Logs
Logs
$ flutter --version
Unhandled exception:
Invalid argument(s): No host specified in URI http:///e2gerror.php?DENIEDURL==http%3A%2F%2F169.254.169.254%2Fmetadata%2Finstance::IP==192.168.5.90::USER==192.168.5.90::FILTERGROUP==Wifi_Profile::CATEGORIES==::REASON==The%20site%20requested%20is%20not%20responding
#0 _HttpClient._openUrl (dart:_http/http_impl.dart:2986:9)
#1 _HttpClient._openUrlFromRequest (dart:_http/http_impl.dart:3097:12)
#2 _HttpClientResponse.redirect (dart:_http/http_impl.dart:693:10)
#3 _HttpClientRequest._handleIncoming.<anonymous closure> (dart:_http/http_impl.dart:1577:27)
#4 _rootRunUnary (dart:async/zone_root.dart:48:47)
#5 _CustomZone.runUnary (dart:async/zone.dart:733:19)
<asynchronous suspension>
#6 _HttpClientRequest._handleIncoming.<anonymous closure> (dart:_http/http_impl.dart:1595:7)
<asynchronous suspension>Additional information
The issue was reproduced on a network that uses a transparent web filter. The filter returned a malformed redirect URL (http:///e2gerror.php?...) while the Azure metadata request was being processed.
AzureDetector.isRunningOnAzure currently handles expected network exceptions, but the unexpected ArgumentError propagates and terminates the Flutter CLI.
Adding a catch-all handler that returns false resolves the issue, and a regression test has been prepared.
Flutter Doctor output
Doctor output
$ flutter doctor -v
Unhandled exception:
Invalid argument(s): No host specified in URI http:///e2gerror.php?DENIEDURL==http%3A%2F%2F169.254.169.254%2Fmetadata%2Finstance::IP==192.168.5.90::USER==192.168.5.90::FILTERGROUP==Wifi_Profil::CATEGORIES==::REASON==The%20site%20requested%20is%20not%20responding
#0 _HttpClient._openUrl (dart:_http/http_impl.dart:2986:9)
#1 _HttpClient._openUrlFromRequest (dart:_http/http_impl.dart:3097:12)
#2 _HttpClientResponse.redirect (dart:_http/http_impl.dart:693:10)
#3 _HttpClientRequest._handleIncoming.<anonymous closure> (dart:_http/http_impl.dart:1577:27)
...flutter doctor -v cannot complete because the CLI crashes before initialization.
</details>
Activity
puneetkukreja98 commentedon Jul 15, 2026
@Ahmet-Can-Urhan Thanks for reporting the issue, have you checked the azure repo to see if there are any related issues open on their side?
puneetkukreja98 commentedon Jul 15, 2026
Similar issue:
#183800
Ahmet-Can-Urhan commentedon Jul 15, 2026
I checked the Azure IMDS documentation and searched the Azure SDK issue trackers, but I couldn't find an existing issue describing this specific behavior.
From what I found, Azure documents that IMDS requests should bypass proxies, and there are existing issues around proxy environments and IMDS connectivity. However, I couldn't find a report where a malformed redirect results in an unexpected ArgumentError propagating to the caller.
Regardless of the root cause, I believe Azure metadata detection in Flutter is a best-effort environment check. Unexpected exceptions during this check should not terminate the Flutter CLI, which is why I proposed handling them the same way as other metadata lookup failures.
puneetkukreja98 commentedon Jul 15, 2026
Routing this to team-tool for further investigation.
Handle unexpected exceptions during Azure metadata detection (flutter…
bkonyi commentedon Aug 6, 2026
Fixed by #189457
github-actions commentedon Aug 20, 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.