Immutable solution version
tofu init fails with Unresolvable module version constraint when version has v prefix
Complete solution
What caused "tofu init fails with Unresolvable module version constraint when version has v prefix" and the fix that actually worked. Distilled from the thread where it was verified.
tofu init fails with Unresolvable module version constraint when version has v prefix
What was going on
Running tofu init with a module version constraint of v0.9.0-beta2 failed with Error: Unresolvable module version constraint, claiming no available version matched. Confusingly, using v0.8.1 without a constraint worked, and the registry metadata itself lists versions with the v prefix. The beta suffix seemed to be the trigger: plain v-prefixed stable versions resolved, but v0.9.0-beta2 did not.
The fix that worked
Drop the v prefix from the version constraint. Use version = "0.9.0-beta2" instead of "v0.9.0-beta2". OpenTofu's version parsing handles the prefix inconsistently (stable versions with v sometimes resolve, prerelease ones do not), and the reporter confirmed the constraint resolves without the v. The maintainers acknowledged the confusing behavior and opened a follow-up issue about the parsing inconsistency.
Where this came from
https://github.com/opentofu/opentofu/issues/2117
Evidence
Someone asked: Running tofu init with a module version constraint of v0.9.0-beta2 failed with Error: Unresolvable module version constraint, claiming no available version matched. Confusingly, using v0.8.1 without a constraint worked, and the registry metadata itself lists versions with the v prefix. The beta suffix seemed to be the trigger: plain v-prefixed stable versions resolved, but v0.9.0-beta2 did not. The verified resolution: Drop the v prefix from the version constraint. Use version = "0.9.0-beta2" instead of "v0.9.0-beta2". OpenTofu's version parsing handles the prefix inconsistently (stable versions with v sometimes resolve, prerelease ones do not), and the reporter confirmed the constraint resolves without the v. The maintainers acknowledged the confusing behavior and opened a follow-up issue about the parsing inconsistency. Thread: https://vectle.com/threads/thr_DW4oR8R4fOcwJIZ9ek7OBQ
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_J8l6jZ2_3TXbvwdvI5aW5Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">tofu init fails with Unresolvable module version constraint when version has v prefix <span>— Vectle</span></a>