You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suddenly get an error from the go toolchain when it tries to download / run sqlc (see below).
Relevant log output
go run github.com/sqlc-dev/sqlc/cmd/sqlc@latest vet
go: github.com/sqlc-dev/sqlc/cmd/sqlc@latest (in github.com/sqlc-dev/sqlc@v1.31.0):
The go.mod file for the module providing named packages contains one or
more replace directives. It must not contain directives that would cause
it to be interpreted differently than if it were the main module.
2026/04/20 08:08:44 exit status 1
exit status 1
Confirming this also breaks go install on v1.31.0 with the same error:
$ go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
go: github.com/sqlc-dev/sqlc/cmd/sqlc@latest (in github.com/sqlc-dev/sqlc@v1.31.0):
The go.mod file for the module providing named packages contains one or
more replace directives. It must not contain directives that would cause
it to be interpreted differently than if it were the main module.
Worth noting that the install docs still recommend go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest, so users following the official instructions will hit this. Pinning to @v1.30.0 works as a workaround.
Reacted by Kevin Joiner, Gram, Miroslav Matejovsky, jaylucasminsta, Jackson Jay McKay, Paul Vaughan, BBQ, Yannick, Nick Grimshaw and Samuel Kunkel
$ make build-linux-arm64
Generating SQLC code...
go run github.com/sqlc-dev/sqlc/cmd/sqlc@latest generate
go: github.com/sqlc-dev/sqlc/cmd/sqlc@latest (in github.com/sqlc-dev/sqlc@v1.31.0):
The go.mod file for the module providing named packages contains one or
more replace directives. It must not contain directives that would cause
it to be interpreted differently than if it were the main module.
make: *** [Makefile:36: sqlc-gen] Error 1
Reacted by Kevin Joiner, Luke, Paul Vaughan, BBQ and Samuel Kunkel
@kyleconroy looks like 1.31.0 has two dependency issues.
MySQL: the replace to github.com/sqlc-dev/mysql added in 21e6557 breaks go install/go run ...@latest, because the Go toolchain explicitly disallows go install cmd@version for modules that contain replace directives in their go.mod (see for example golang/go#44840).
SQLite: as in #4399, updating to github.com/ncruces/go-sqlite3 causes an Xenv interface mismatch (*env missing Xstrtol), so sqlc generate with SQLite no longer builds.
Maybe a 1.31.1 that isolates or rolls back these dependency changes could help people using the default install and SQLite paths. Happy to help test any fix.
Activity
johan-kjolhede-kivra commentedon Apr 20, 2026
Confirming this also breaks
go installon v1.31.0 with the same error:Caused by this directive added in v1.31.0:
Worth noting that the install docs still recommend
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest, so users following the official instructions will hit this. Pinning to@v1.30.0works as a workaround.axbrunn commentedon Apr 20, 2026
Same here:
vaughany commentedon Apr 21, 2026
Same issue here.
rubensantoniorosa2704 commentedon Apr 21, 2026
@kyleconroy looks like 1.31.0 has two dependency issues.
MySQL: the replace to github.com/sqlc-dev/mysql added in 21e6557 breaks go install/go run ...@latest, because the Go toolchain explicitly disallows go install cmd@version for modules that contain replace directives in their go.mod (see for example golang/go#44840).
SQLite: as in #4399, updating to github.com/ncruces/go-sqlite3 causes an Xenv interface mismatch (*env missing Xstrtol), so sqlc generate with SQLite no longer builds.
Maybe a 1.31.1 that isolates or rolls back these dependency changes could help people using the default install and SQLite paths. Happy to help test any fix.
kyleconroy commentedon Apr 21, 2026
Hey all, looking into this today. For now please reference the previous version.
After fixing it I'll make sure to add some tests to make sure this type of issue doesn't happen again.
Drop ci.yml changes; rely on existing 'go test ./...' step
kyleconroy commentedon Apr 22, 2026
Fixed in v1.31.1