flutter doctor fails the Network resources check
A 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.
Fix it fast
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"2Match what you see, then jump to its fix
- 1
Environment variable PUB_HOSTED_URL (or FLUTTER_STORAGE_BASE_URL) does not specify a valid URLA mirror environment variable holds an invalid URLFix - 2
A 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
- 1
What does the error look like?
A network error occurred while checking "github.com":A cryptographic error occurred while checkingEnvironment variable PUB_HOSTED_URL does not specify a valid URLNetwork 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 doctorConfirmed by docs.flutter.dev
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.com2Fix
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:port3Verify
The curl calls return a status line, then doctor passes.
flutter doctor -vConfirmed by dart.dev
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:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- Qist BazaarA buy-now-pay-later marketplace built from a blank repo, now past 100K downloads on Google Play.
- SessionBirdAn omnichannel engagement suite in Flutter: campaigns, chatbot, tickets, analytics and live calling.
Related fixes
Mobile apps
Terminal says pub: command not found after installing Dart
dart: command not found
The standalone pub program no longer exists in current Dart.
2 causes, each with a fixMobile apps
The terminal cannot find the flutter or dart command
zsh: command not found: flutter
The flutter and dart programs both live in the bin folder of the Flutter SDK, so one PATH entry gives you both.
3 causes, each with a fixMobile apps
flutter doctor warns that dart on your path is not in the Flutter SDK
Consider adding C:\flutter\bin to the front of your path.
flutter doctor found a dart program on your PATH that lives outside the Flutter SDK folder, usually a separate Dart SDK installed earlier in the list.
3 causes, each with a fixMobile apps
A Flutter command says it cannot find pubspec.yaml
This command should be run from the root of your Flutter project.
Flutter and Dart read pubspec.yaml from the current working directory.
3 causes, each with a fixMobile apps
Flutter keeps retrying 'pub upgrade' for its own tool
Got socket error trying to find package
The flutter command rebuilds its own tool and downloads packages from pub.dev to do it.
3 causes, each with a fixMobile apps
Terminal says fvm: command not found after installing FVM
zsh: command not found: fvm
The shell cannot find an fvm executable.
2 causes, each with a fix