Skip to content

Direct bump with changelog creation not possible using semver2, custom tag_format and prerelease option #1614

Description

@pydal

Description

When using a custom tag_format like ${major}.${minor}-${patch}${prerelease} with semver2 the changelog cannot be create directly using cz bump --prerelase rc with update_changelog_on_bump = true. Only generating the changelog manually using cz ch lets the bump succeed.

The error occurse in a bump chain 0.0.1 → 0.0.2 → 0.0.3-rc.0 → 0.0.3-rc.1

Furthermore, using prereleases, cz changelog always throw warnings like:

Invalid version tag: '0.0-2rc.0' does not match any configured tag format

It seems that the git tag is not parsed correctly when using custom tag_format and semver2.

See a szenario in steps to reproduce.

Steps to reproduce

  1. Initialize git project and place cz configuration:
git init .
cat << EOF | tee cz.toml
[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "\${major}.\${minor}-\${patch}\${prerelease}"
version_scheme = "semver2"
version = "0.0.1"
update_changelog_on_bump = true
EOF
  1. Create a first commit
echo "# test" | tee README.md
git add README.md cz.toml
git commit -m "fix: Add readme file"
  1. Bump a prerelease
cz bump --prerelease rc --yes
  1. Add changes, commit and create changelog
echo "Some changes" | tee -a README.md
git add README.md
git commit -m "fix: Add changes to readme file"
  1. Try to bump another prerelease version (failing)
cz bump --prerelease rc --yes
  1. Generate changelog (succeeding with warning)
cz changelog
  1. Try to bump prerelease version again (succeeding)
cz bump --prerelease rc

Current behavior

Bumping without prior changelog generation fails with:

Invalid version tag: '0.0-2rc.0' does not match any configured tag format

Only if the changelog is created before bumping (so that # Unreleased heading appears) let's you create a bump.

Furthermore commitizen does not recognize custom tags with prerelease part correctly, resulting in warnings using cz changelog like:

Invalid version tag: '0.0-2rc.1' does not match any configured tag format
Invalid version tag: '0.0-2rc.0' does not match any configured tag format

Desired behavior

  1. Changelog generation shall recognize the tags using custom tag_format with ${prerelease}
  2. Bumping with changelog creation shall succeed without generating changelog before

Screenshots

n/a

Environment

Commitizen Version: 4.9.1
Python Version: 3.9.21 (main, Aug 19 2025, 00:00:00)
[GCC 11.5.0 20240719 (Red Hat 11.5.0-5)]
Operating System: Linux

Activity

  1. bearomorphism commented on May 9, 2026

    @bearomorphism
    Collaborator

    Triage from #1964: Still valid. The interaction between custom tag_format containing ${prerelease}, version_scheme = "semver2", and cz bump --prerelease produces 0.0-2rc.0 instead of the expected tag, and the changelog parser then can't recognise it. Likely shares a root cause with #1615 — needs investigation in commitizen/tags.py::normalize_tag.

  2. bearomorphism commented on May 9, 2026

    @bearomorphism
    Collaborator

    Verification update (re #1964)

    Reproduced against current master (4.15.1):

    Config: tag_format = "${major}.${minor}-${patch}${prerelease}", version_scheme = "semver2", version = "0.0.1".

    After first cz bump --prerelease rc --yes:

    git tag --list
    0.0-2rc.0
    

    The tag is malformed (note 0.0-2 instead of 0.0.2). Second cz bump --prerelease rc --yes fails:

    Invalid version tag: '0.0-2rc.0' does not match any configured tag format
    No tag found to do an incremental changelog
    (exit 16)
    

    cz changelog --dry-run also warns about the same invalid tag.

    Verdict: STILL VALID. Two related root causes:

    1. commitizen/tags.py::normalize_tag produces tags that can't be re-parsed by the same tag_format regex when the format mixes literal - with ${prerelease} and semver2 prerelease syntax.
    2. The first bump's tag rendering is itself malformed (0.0-2rc.0 looks like the substitution interpreted ${patch} as ${minor}-${patch} boundaries unexpectedly).

    Likely closely related to #1615 (devrelease substitution issue).

  3. added a commit that references this issue on May 15, 2026
    c6b8c44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions