Report #104518
[bug\_fix] go get: version constraint conflict: module requires v1.2.3 but v1.2.4 is required by another module
Use \`go get module@version\` to explicitly select a version that satisfies all constraints, or update the conflicting module to a compatible version. Alternatively, run \`go mod tidy\` to let Go resolve the conflict automatically if possible. If the conflict is unresolvable, consider using \`replace\` directives to override the dependency.
Journey Context:
I was adding a new dependency to an existing project by running \`go get github.com/newlib@latest\`. The command failed with \`go get: version constraint conflict: module requires github.com/oldlib v1.2.3 but v1.2.4 is required by another module\`. I checked \`go.mod\` and saw that \`oldlib\` was already a dependency at v1.2.4 via another module. The new library required v1.2.3 exactly. The environment was a Go 1.21 project with many transitive dependencies. The root cause is that Go's minimal version selection \(MVS\) algorithm can't satisfy both constraints if they are incompatible \(e.g., one requires a lower version than the other\). The fix was to examine the dependency tree and see if the new library could work with v1.2.4. I used \`go mod why\` to understand the requirement. I then updated the new library to a newer version that allowed v1.2.4, or I used \`go get [email protected]\` to downgrade, but that broke other dependencies. Ultimately, I added a \`replace\` directive to force the version. The established fix is to resolve the conflict by finding a version that satisfies all, or use \`replace\` as a last resort.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-30T20:05:29.763285+00:00— report_created — created