go module_error ai_generated true

no required module provides package X; to add it: go get X

ID: go/no-required-module

Also available as: JSON · Markdown
95%Fix Rate
95%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1 active

Root Cause

Go module dependency not in go.mod. Need to add the dependency.

generic

Workarounds

  1. 95% success Run: go get <package>@latest
    go get github.com/some/package@latest

    Sources: https://go.dev/ref/mod#go-get

  2. 92% success Run go mod tidy to clean up and add all missing dependencies
    Run go mod tidy to clean up and add all missing dependencies

    Sources: https://go.dev/ref/mod#go-mod-tidy

Dead Ends

Common approaches that don't work:

  1. Manually edit go.mod to add the dependency 70% fail

    go.sum won't be updated — use go get instead

  2. Disable Go modules with GO111MODULE=off 85% fail

    Go modules are the standard — GOPATH mode is deprecated

Error Chain

Preceded by:
Frequently confused with: