Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Node.js, PHP and APIs

go install stops at invalid GOSUMDB: malformed verifier id

Your error

verifying module: invalid GOSUMDB: malformed verifier id2 more lines it can show

Fix it fast

Most common cause, 1 of 3

GOSUMDB holds a URL or a mistyped form of sum.golang.org

Remove the custom value so Go falls back to sum.golang.org.

Fix
go env -u GOSUMDB
# only if you need a different address for the same database:
go env -w GOSUMDB="sum.golang.org https://sum.golang.google.cn"
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

invalid GOSUMDB: malformed verifier id means the first word of GOSUMDB is neither a checksum database Go knows nor a full name+hash+key verifier. A URL such as https://sum.golang.org, a mirror host, or a private database named without its key all fail. Run go env -u GOSUMDB, or supply the full key. Applies to Go 1.26 and 1.27.

  • Applies to Go 1.27.4, Go 1.26.11, VS Code Go extension (go.toolsEnvVars)
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Print the value Go really uses and list every setting that differs from the defaults. A value with https:// or a host other than sum.golang.org points to cause 1 or 2. If go env -w seems to change nothing, cause 3 applies.

Run this first
go env GOSUMDB
go env -changed

Then find the line you see in this list and open its fix:

  1. 1GOSUMDB holds a URL or a mistyped form of sum.golang.orggo env GOSUMDB prints something like https://sum.golang.org, sum.golang.org/ or a proxy address
  2. 2A private or third-party checksum database is named without its public keyThe value is a single host such as sumdb.example.com with no plus signs in it
  3. 3An OS, CI or editor variable overrides what go env -w storesgo env -w prints a warning about a conflicting OS environment variable, or the error appears only inside VS Code

What does the error look like?

  • verifying module: invalid GOSUMDB: malformed verifier id
  • verifying go.mod: invalid GOSUMDB: malformed verifier id
  • warning: go env -w GOSUMDB=... does not override conflicting OS environment variable

Cause 1 of 3

GOSUMDB holds a URL or a mistyped form of sum.golang.org

You seego env GOSUMDB prints something like https://sum.golang.org, sum.golang.org/ or a proxy address

Check

The malformed verifier id error comes from the first space-separated word of GOSUMDB. Go takes only a few plain values: off, sum.golang.google.cn on its own (an alias for the same database), or sum.golang.org, whose key Go already carries, optionally followed by a URL. Any other first word must be a full verifier key, so a scheme, a trailing slash or a proxy address fails as soon as the first module needs checking.

Check
go env GOSUMDB

Fix

Remove the custom value so Go falls back to sum.golang.org. To reach the same database through a different address, keep the name first and put the URL second.

Fix
go env -u GOSUMDB
# only if you need a different address for the same database:
go env -w GOSUMDB="sum.golang.org https://sum.golang.google.cn"

Verify

go env GOSUMDB prints sum.golang.org (or your two-part value), and the install that failed now downloads and verifies.

Verify
go install golang.org/x/tools/gopls@latest

Confirmed by go.dev

Did this fix it?

Cause 2 of 3

A private or third-party checksum database is named without its public key

You seeThe value is a single host such as sumdb.example.com with no plus signs in it

Check

Go's modules reference says the go command knows only the key of sum.golang.org, and any other database needs its public key given explicitly. The source parses that word as name+hash+key, where the hash is eight hex digits and the key is base64; a bare host has neither part, which yields malformed verifier id.

Check
go env GOSUMDB GONOSUMDB GOPRIVATE

Fix

Ask the operator of that database for its verifier key and set the full string, with the URL as the optional second word. If you only wanted to skip the public database for your own modules, leave GOSUMDB alone and list the module prefix in GOPRIVATE instead.

Fix
go env -w GOSUMDB="sumdb.example.com+<hash>+<base64-key> https://sumdb.example.com"
# or, for private modules only:
go env -u GOSUMDB
go env -w GOPRIVATE=git.example.com/myteam

Verify

go env GOSUMDB shows the three-part key (or the default), and go mod download finishes without the verifier error.

Verify
go mod download

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 3 of 3

An OS, CI or editor variable overrides what go env -w stores

You seego env -w prints a warning about a conflicting OS environment variable, or the error appears only inside VS Code

Check

When the bad value lives in the process environment, go env -w cannot replace it: the stored file only sets defaults, an exported variable wins, and go env -w prints a warning that it does not override the conflicting OS variable. The VS Code Go extension hands go.toolsEnvVars to the Go tools it starts, so a GOSUMDB entry there breaks tool installs while the terminal works.

Check
echo "$GOSUMDB"
grep -rn "GOSUMDB" ~/.bashrc ~/.zshrc ~/.profile .vscode/settings.json 2>/dev/null

Fix

Delete the variable where it is defined (shell profile, CI variables or go.toolsEnvVars in VS Code settings), open a new terminal or reload the editor, then run the install again.

Fix
unset GOSUMDB
go env -u GOSUMDB
go env GOSUMDB

Verify

echo $GOSUMDB prints an empty line, go env GOSUMDB prints sum.golang.org, and Go: Install/Update Tools in VS Code completes.

Verify
go env GOSUMDB

Confirmed by raw.githubusercontent.com

Did this fix it?

How do I stop it coming back?

  • Set Go variables with go env -w on developer machines and keep them out of shell profiles, so there is one place to look.
  • Use GOPRIVATE or GONOSUMDB for internal module paths instead of rewriting GOSUMDB for every module.
  • In CI, print go env GOSUMDB GOPROXY GOPRIVATE at the start of the job so a bad value shows in the first lines of the log.

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.

Next step

Want this handled for good?

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