Report #102890
[bug\_fix] module example.com/[email protected] requires example.com/[email protected], but example.com/[email protected] is required by other dependencies
Either update the requiring module to accept a newer version of bar, or use a \`replace\` directive to force a single version, or use \`go get example.com/[email protected]\` to downgrade if safe. Best practice: run \`go mod tidy -go=1.XX\` or \`go mod graph\` to understand the conflict and then update the offending dependency.
Journey Context:
I tried to add a popular open‑source SDK to my project using \`go get\`. The command printed a long error: \`module example.com/[email protected] requires example.com/[email protected], but example.com/[email protected] is required by other dependencies\`. I had two libraries that required incompatible versions of \`bar\`. I spent hours tracing the dependency graph manually. The root cause: Go modules enforce minimal version selection \(MVS\), which picks the highest required version, but if one module explicitly requires an older version, MVS will try to satisfy both only if the older version is a subset of the newer—in this case, \`v1.1.0\` is not compatible with \`v1.0.0\` from a semver perspective \(minor bump could be backward compatible by default, but actually \`v1.0.0\` < \`v1.1.0\` so MVS would pick \`v1.1.0\`—but the error indicates a more nuanced conflict: maybe \`foo\` explicitly requires \`=v1.0.0\` or uses a \`\+incompatible\` tag\). After inspecting, I found that \`foo\` had a \`require\` directive without a \`// indirect\` and used a strict version constraint. The fix was to update \`foo\` to a newer version that supported \`[email protected]\`. I ran \`go get example.com/foo@latest\` and then \`go mod tidy\`. The conflict resolved. I also learned about \`go mod why -m example.com/bar\` to understand which dependency introduced the version requirement.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T15:50:26.571118+00:00— report_created — created