Fixing “GOPROXY list is not the empty string, but contains no entries” in Go

If you’ve ever run go mod tidy and been greeted by a wall of red text ending in:

go: todo-services imports
github.com/99designs/gqlgen: GOPROXY list is not the empty string, but contains no entries

…you’re not alone. This error looks…


This content originally appeared on DEV Community and was authored by Akkarapon Phikulsri

If you've ever run go mod tidy and been greeted by a wall of red text ending in:

go: todo-services imports
        github.com/99designs/gqlgen: GOPROXY list is not the empty string, but contains no entries

...you're not alone. This error looks scary because it repeats for every single import in your project, but the actual fix takes about 30 seconds. Here's what's going on and how to solve it.

What This Error Actually Means

Go resolves modules through GOPROXY, an environment variable that tells the toolchain where to fetch dependencies from. The error message is oddly specific:

"GOPROXY list is not the empty string, but contains no entries"

This means GOPROXY is set to something, but once Go parses it, there are zero usable proxy URLs in it. Common causes:

  • A stray comma or pipe with no actual URL (GOPROXY=, or GOPROXY=|)
  • GOPROXY=off, which explicitly disables all proxying
  • A shell-level override with a blank or whitespace value that shadows your real Go config
  • A corporate/custom proxy URL that no longer resolves

This is especially common on Windows with Git Bash (MINGW64), where environment variables inherited from Windows user/system settings can silently override what Go has configured in its own env file.

Step-by-Step Fix

1. Check for a shell-level override

Environment variables set in your current shell session take priority over Go's own config file. Check what's actually there:

echo "GOPROXY=[$GOPROXY]"

If this prints GOPROXY=[], GOPROXY=[ ], or something malformed, that's your problem — the shell is passing Go a broken value.

2. Clear the session override

unset GOPROXY

This drops the bad value for the current session and lets Go fall back to its own configuration.

3. Persist a valid proxy in Go's config

This writes directly to Go's env file (%USERPROFILE%\AppData\Roaming\go\env on Windows, ~/.config/go/env on Linux/macOS):

go env -w GOPROXY=https://proxy.golang.org,direct

The ,direct fallback tells Go to bypass the proxy and fetch directly from source control if a module isn't available there — a good safety net.

If you're behind a corporate network or VPN, swap in your internal proxy instead:

go env -w GOPROXY=https://your-company-proxy.example.com,direct

4. Sanity-check related settings

go env GOPROXY GOFLAGS GOSUMDB

Expected healthy values:

Variable Expected value
GOPROXY https://proxy.golang.org,direct (or your internal proxy + ,direct)
GOFLAGS Empty, unless you intentionally use flags like -mod=mod
GOSUMDB sum.golang.org (default), unless disabled for a reason

5. Clear Go's caches if the problem persists

Sometimes a bad proxy state gets baked into cached build artifacts or module downloads. If steps 1–4 didn't fully resolve things, nuke the caches:

go clean -cache -testcache -modcache
Flag Clears
-cache Compiled build cache
-testcache Cached test results
-modcache Downloaded modules ($GOPATH/pkg/mod)

This forces a full re-download of every dependency on your next build, using your now-corrected proxy settings.

6. Retry

go mod tidy

At this point, all those GOPROXY list is not the empty string... lines should be gone, replaced by normal module resolution output for todo-services.

Windows/MINGW64 Gotcha

If GOPROXY keeps reverting to a bad value in new terminal sessions, the override probably lives in Windows System Properties → Environment Variables, not just in go env. Go's own persisted config won't help if Windows keeps re-injecting a bad value into every new shell. Check it directly:

cat "$USERPROFILE/AppData/Roaming/go/env"

Quick Reference Checklist

  • echo "GOPROXY=[$GOPROXY]" — no stray/invalid shell override
  • unset GOPROXY — if a bad session override exists
  • go env -w GOPROXY=https://proxy.golang.org,direct — sets a valid persistent proxy
  • go env GOPROXY GOFLAGS GOSUMDB — confirms sane values
  • go clean -cache -testcache -modcache — if issues persist
  • go mod tidy — succeeds after the above

Command Cheat Sheet

go version                            # Confirm installed Go version
go env                                # Print all Go environment settings
go env GOPROXY                        # Print a specific setting
go env -w KEY=VALUE                   # Persist a setting to Go's env file
go env -u KEY                         # Unset a persisted setting (revert to default)
go mod tidy                           # Sync go.mod/go.sum with imports
go clean -cache -testcache -modcache  # Clear build, test, and module caches

If this saved you a headache, drop a — and if you've hit a different flavor of this error, I'd love to hear about it in the comments.


This content originally appeared on DEV Community and was authored by Akkarapon Phikulsri


Print Share Comment Cite Upload Translate Updates
APA

Akkarapon Phikulsri | Sciencx (2026-07-22T10:05:57+00:00) Fixing “GOPROXY list is not the empty string, but contains no entries” in Go. Retrieved from https://www.scien.cx/2026/07/22/fixing-goproxy-list-is-not-the-empty-string-but-contains-no-entries-in-go-2/

MLA
" » Fixing “GOPROXY list is not the empty string, but contains no entries” in Go." Akkarapon Phikulsri | Sciencx - Wednesday July 22, 2026, https://www.scien.cx/2026/07/22/fixing-goproxy-list-is-not-the-empty-string-but-contains-no-entries-in-go-2/
HARVARD
Akkarapon Phikulsri | Sciencx Wednesday July 22, 2026 » Fixing “GOPROXY list is not the empty string, but contains no entries” in Go., viewed ,<https://www.scien.cx/2026/07/22/fixing-goproxy-list-is-not-the-empty-string-but-contains-no-entries-in-go-2/>
VANCOUVER
Akkarapon Phikulsri | Sciencx - » Fixing “GOPROXY list is not the empty string, but contains no entries” in Go. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2026/07/22/fixing-goproxy-list-is-not-the-empty-string-but-contains-no-entries-in-go-2/
CHICAGO
" » Fixing “GOPROXY list is not the empty string, but contains no entries” in Go." Akkarapon Phikulsri | Sciencx - Accessed . https://www.scien.cx/2026/07/22/fixing-goproxy-list-is-not-the-empty-string-but-contains-no-entries-in-go-2/
IEEE
" » Fixing “GOPROXY list is not the empty string, but contains no entries” in Go." Akkarapon Phikulsri | Sciencx [Online]. Available: https://www.scien.cx/2026/07/22/fixing-goproxy-list-is-not-the-empty-string-but-contains-no-entries-in-go-2/. [Accessed: ]
rf:citation
» Fixing “GOPROXY list is not the empty string, but contains no entries” in Go | Akkarapon Phikulsri | Sciencx | https://www.scien.cx/2026/07/22/fixing-goproxy-list-is-not-the-empty-string-but-contains-no-entries-in-go-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.