Skip to content

Flutter CLI crashes when Azure metadata detection throws an unexpected exception #189456

Closed

Description

@Ahmet-Can-Urhan

Steps to reproduce

Steps to reproduce

Run any Flutter CLI command such as:

flutter --version

in 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

  1. puneetkukreja98 commented on Jul 15, 2026

    @puneetkukreja98
    Contributor

    @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?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    and removed
    in triagePresently being triaged by the triage team
    on Jul 15, 2026
  3. puneetkukreja98 commented on Jul 15, 2026

    @puneetkukreja98
    Contributor

    Similar issue:
    #183800

  4. Ahmet-Can-Urhan commented on Jul 15, 2026

    @Ahmet-Can-Urhan
    ContributorAuthor

    @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?

    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.

  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jul 15, 2026
  6. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    team-toolOwned by Flutter Tool team
    on Jul 15, 2026
  7. puneetkukreja98 commented on Jul 15, 2026

    @puneetkukreja98
    Contributor

    Routing this to team-tool for further investigation.

  8. added
    P2Important issues not at the top of the work list
    triaged-toolTriaged by Flutter Tool team
    on Aug 4, 2026
  9. bkonyi commented on Aug 6, 2026

    @bkonyi
    Contributor

    Fixed by #189457

  10. github-actions commented on Aug 20, 2026

    @github-actions

    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 -v and a minimal reproduction of the issue.

  11. locked as resolved and limited conversation to collaborators on Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions