Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mrjrieke opened this issue Mar 31, 2025 · 3 comments
Assignees
Labels
BugReport Issues describing a possible bug in the Go implementation. GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@mrjrieke
Copy link

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/[email protected]] 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

@seankhliao seankhliao changed the title go mod tidy panic cmd/go: mod tidy panic: internal error: adding to module graph had no effect on root requirements. Mar 31, 2025
@seankhliao
Copy link
Member

Do you have a reproducer for the issue?

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Mar 31, 2025
@mrjrieke
Copy link
Author

mrjrieke commented Mar 31, 2025

So, this ends up being something pretty silly. But it probably still shouldn't panic. In my extension project, I accidentally referenced in my go.mod the module path of the parent project.

My extension project go.mod looked like:
module github.com/trimble-oss/tierceron

go 1.24.1
.... etc...

It should have been:
module github.com/myproject

I'd recommend a fix to prevent the panic, but understand if you have other pressing issues and just want to close this.

The worst part I guess is that it seems like a huge problem with go proxy issues on to anything else mysterious..... When in fact it was a silly and simple copy pasta issue on my end.

@seankhliao seankhliao removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 31, 2025
@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Mar 31, 2025
@matloob matloob assigned matloob and samthanawalla and unassigned matloob Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants