Skip to content

cmd/go: mod tidy panic: internal error: adding to module graph had no effect on root requirements. #73108

@mrjrieke

Description

@mrjrieke

Go version

go1.24.1

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN='/redacted/bin'
GOCACHE='/redacted/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/redacted/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1348906678=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/redacted/someproject/go.mod'
GOMODCACHE='/redacted/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/redacted/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTELEMETRYDIR='/redacted/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.1'
GOWORK='redacted/someproject/go.work'
PKG_CONFIG='pkg-config'

What did you do?

Create a project to extend github.com/trimble-oss/tierceron. In this, I reference:
github.com/trimble-oss/tierceron v1.36.2

There are multiple mysteries surrounding this dependency. I think most of the problems are probably mine, but I somehow don't think that go mod tidy should panic here...

What did you see happen?

One of them leads to a go mod loadFromRoots panic.
panic: internal error: adding [github.com/trimble-oss/tierceron@v0.0.0-00010101000000-000000000000] to module graph had no effect on root requirements... giant list of imports and dependencies....

cmd/go/internal/modload.loadFromRoots({0xc85b00, 0x10bb180}, {{{0x0, 0x0}, 0xc000174cc0, 0x1, 0x0, {0x0, 0x0}, 0x1, ...}, ...})
cmd/go/internal/modload/load.go:1232 +0x1839
cmd/go/internal/modload.LoadPackages({0xc85b00, 0x10bb180}, {{0x0, 0x0}, 0xc000174cc0, 0x1, 0x0, {0x0, 0x0}, 0x1, ...}, ...)
cmd/go/internal/modload/load.go:366 +0x4a8
cmd/go/internal/modcmd.runTidy({0xc85b00, 0x10bb180}, 0xc000024810?, {0xc000020230?, 0xb5d2e0?, 0xb5e094?})
cmd/go/internal/modcmd/tidy.go:133 +0x2b8
main.invoke(0x108ad80, {0xc000020230, 0x1, 0x1})
cmd/go/main.go:341 +0x845
main.main()
cmd/go/main.go:220 +0xe8b

What did you expect to see?

Some kind of nice error message indicating what's truly wrong with the structure of the project. A panic indicates an unexpected condition in the tool...

I should not that in order to work around some problems with proxy not recognizing this project, I cloned the project and did a replace in my extension project:

replace github.com/trimble-oss/tierceron => ../tierceron

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions