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
{{ message }}
Repository navigation
Help wanted: commitizen 3.x not supoort generate CHANGELOG with tag format like v1.0.0-release #950
This is also happening for maven type versions (using cz version 3.13.0):
cz init
Welcome to commitizen!
Answer the questions to configure your project.
For further configuration visit:
https://commitizen-tools.github.io/commitizen/config/
? Please choose a supported config file: .cz.toml
? Please choose a cz (commit rule): (default: cz_conventional_commits) cz_conventional_commits
? Choose the source of the version: commitizen: Fetch and set version in commitizen config (default)
? Is master_0.0.2-SNAPSHOT.74 the latest tag? No
? Please choose the latest tag: v0.0.1-SNAPSHOT
? Choose version scheme: semver
Traceback (most recent call last):
File "/usr/local/bin/cz", line 8, in<module>sys.exit(main())
^^^^^^
File "/usr/local/Cellar/commitizen/3.13.0/libexec/lib/python3.12/site-packages/commitizen/cli.py", line 570, in main
args.func(conf, arguments)()
File "/usr/local/Cellar/commitizen/3.13.0/libexec/lib/python3.12/site-packages/commitizen/commands/init.py", line 100, in __call__
version = get_version_scheme(self.config, version_scheme)(tag)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/opt/python-packaging/lib/python3.12/site-packages/packaging/version.py", line 200, in __init__
raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: 'v0.0.1-SNAPSHOT'
Triage from #1964: This is a config issue, not a bug. Tags like v1.0.0-release need a matching tag_format = "v$version-release" (or use legacy_tag_formats for old tags). Without that, commitizen can't extract a version from the tag — hence the InvalidVersion warning. Suggesting we close this.
Test A — default tag_format = "v$version" with manually-created tags v0.7.0-release and v0.7.1-release:
## Unreleased
### Feat
- new
No InvalidVersion warnings, but the suffixed tags are silently ignored (treated as not-version tags) and don't appear as release headings.
Test B — tag_format = "v$version-release" (matching the actual tag pattern):
## Unreleased
### Feat
- new
## v0.7.0-release (2026-05-09)
Tags are recognized correctly, no warnings.
Verdict: NOT A BUG / CONFIG-ONLY.
Two notes:
The original report's InvalidVersion ... v0.7.1-release warnings don't reproduce on current master with the default tag_format. The current TagRules warns on tags that look like versions but don't match (good UX), and silently skips ones that don't look like versions at all.
Setting tag_format = "v$version-release" (or legacy_tag_formats = ["v$version-release"] if mixing tag styles) makes the suffix-tags work as expected.
Closing-eligible with a short response pointing the user to the matching tag_format.
Closing as config issue: setting tag_format = "v\$version-release" (or adding it to legacy_tag_formats) makes the suffix tags work correctly. See verification comment above. Reopen if the matching tag_format doesn't work for your case.
Activity
rshmhrj commentedon Jan 17, 2024
This is also happening for maven type versions (using cz version 3.13.0):
Lee-W commentedon Apr 23, 2024
Thanks for reporting. Just verified this is a valid issue.
Lee-W commentedon Apr 23, 2024
The root cause is
commitizen/commitizen/version_schemes.py
Line 152 in ac07bda
I guess we'll need to overwrite https://github.com/pypa/packaging/blob/32deafe8668a2130a3366b98154914d188f3718e/src/packaging/version.py#L185 to something like https://github.com/pypa/packaging/blob/32deafe8668a2130a3366b98154914d188f3718e/src/packaging/version.py#L117 but with semver support?
@noirbizarre @woile WDYT?
woile commentedon Apr 23, 2024
Definitely a good idea, we should add tests for
semverandsemver2Lee-W commentedon Apr 24, 2024
Added tests first #1081
fix: fix bumping version functionality by removing changelog function…
fix(version_schemes): support arbitrary semver pre-release labels
fix(version_schemes): support arbitrary semver pre-release labels
fix(version_schemes): support arbitrary semver pre-release labels
fix(version_schemes): support arbitrary semver pre-release labels
fix(version_schemes): support arbitrary semver pre-release labels
fix(version_schemes): support arbitrary semver pre-release labels
fix(version_schemes): support arbitrary semver pre-release labels
bearomorphism commentedon May 9, 2026
Triage from #1964: This is a config issue, not a bug. Tags like
v1.0.0-releaseneed a matchingtag_format = "v$version-release"(or uselegacy_tag_formatsfor old tags). Without that, commitizen can't extract a version from the tag — hence theInvalidVersionwarning. Suggesting we close this.bearomorphism commentedon May 9, 2026
Verification update (re #1964)
Reproduced against current master (4.15.1):
Test A — default
tag_format = "v$version"with manually-created tagsv0.7.0-releaseandv0.7.1-release:No
InvalidVersionwarnings, but the suffixed tags are silently ignored (treated as not-version tags) and don't appear as release headings.Test B —
tag_format = "v$version-release"(matching the actual tag pattern):Tags are recognized correctly, no warnings.
Verdict: NOT A BUG / CONFIG-ONLY.
Two notes:
InvalidVersion ... v0.7.1-releasewarnings don't reproduce on current master with the defaulttag_format. The currentTagRuleswarns on tags that look like versions but don't match (good UX), and silently skips ones that don't look like versions at all.tag_format = "v$version-release"(orlegacy_tag_formats = ["v$version-release"]if mixing tag styles) makes the suffix-tags work as expected.Closing-eligible with a short response pointing the user to the matching
tag_format.bearomorphism commentedon May 9, 2026
Closing as config issue: setting
tag_format = "v\$version-release"(or adding it tolegacy_tag_formats) makes the suffix tags work correctly. See verification comment above. Reopen if the matching tag_format doesn't work for your case.