Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

flutter doctor fails the Network resources check

ErrorA network error occurred while checking "github.com":

Short answer

The Network resources check sends a request to a fixed list of hosts and fails if one does not answer. Run flutter doctor -v to see which host failed. Two causes are documented: a PUB_HOSTED_URL or FLUTTER_STORAGE_BASE_URL variable that is not a valid URL, and a firewall, proxy or security tool blocking a host.

  • Applies to Flutter 3.3x stable, Dart 3.x, macOS, Linux, Windows
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the full doctor report. The Network resources block names the host that failed, which tells you whether to look at your variables or at the network.

    flutter doctor -v
    env | grep -E "PUB_HOSTED_URL|FLUTTER_STORAGE_BASE_URL"
  2. 2Match what you see, then jump to its fix

    1. 1Environment variable PUB_HOSTED_URL (or FLUTTER_STORAGE_BASE_URL) does not specify a valid URLA mirror environment variable holds an invalid URLFix
    2. 2A network error occurred while checking "<host>" (host is github.com, pub.dev, storage.googleapis.com, maven.google.com or cocoapods.org)A firewall, proxy or security tool blocks one of the hostsFix

What does the error look like?

  • A network error occurred while checking "github.com":
  • A cryptographic error occurred while checking
  • Environment variable PUB_HOSTED_URL does not specify a valid URL
  • Network resources check is taking a long time...

Cause 1 of 2

A mirror environment variable holds an invalid URL

1Check

The check contacts pub.dev and storage.googleapis.com unless these two variables are set, and then it contacts the URL in the variable instead. A value without https://, with a stray space or with a typo fails. Flutter's mirror guide shows the expected form.

echo "$PUB_HOSTED_URL"
echo "$FLUTTER_STORAGE_BASE_URL"

2Fix

Either unset both variables if you do not use a mirror, or set them to full https URLs as the mirror guide shows.

unset PUB_HOSTED_URL FLUTTER_STORAGE_BASE_URL
# or, with a mirror:
export PUB_HOSTED_URL="https://pub.flutter-io.cn"
export FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn"

3Verify

Open a new terminal so old values are gone, then run doctor again.

flutter doctor

Confirmed by docs.flutter.dev

Did this fix it?

Cause 2 of 2

A firewall, proxy or security tool blocks one of the hosts

1Check

Flutter's source checks github.com, pub.dev, storage.googleapis.com, maven.google.com when Android is enabled, and cocoapods.org when macOS is enabled. Request the failing host yourself from the same machine.

curl -I https://pub.dev
curl -I https://storage.googleapis.com
curl -I https://github.com

2Fix

Ask whoever runs the network to allow these hosts. Dart's pub tool honors the https_proxy environment variable, so behind a corporate proxy set it for the shell where you run Flutter. Also check that no security software blocks the dart executable.

export https_proxy=hostname:port

3Verify

The curl calls return a status line, then doctor passes.

flutter doctor -v

Confirmed by dart.dev

Did this fix it?

How do I stop it coming back?

  • Keep mirror variables in one shell profile file, so you know where a wrong value comes from.
  • After you change network or VPN, run flutter doctor -v before you suspect the SDK.
  • Record the proxy settings your workplace needs in your setup notes.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.