{"record":{"id":"3fe3c8f63644f069","repo":"Aider-AI/aider","slug":"new-version-new-version-must-be-greater-than-the","errorCode":null,"errorMessage":"New version {new_version} must be greater than the current version {current_version}","messagePattern":"New version (.+?) must be greater than the current version (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/versionbump.py","lineNumber":111,"sourceCode":"        check_working_directory_clean()\n        check_main_branch_up_to_date()\n        check_ok_to_push()\n    else:\n        print(\"Skipping pre-push checks due to --force flag.\")\n\n    new_version_str = args.new_version\n    if not re.match(r\"^\\d+\\.\\d+\\.\\d+$\", new_version_str):\n        raise ValueError(f\"Invalid version format, must be x.y.z: {new_version_str}\")\n\n    new_version = version.parse(new_version_str)\n    incremented_version = version.Version(\n        f\"{new_version.major}.{new_version.minor}.{new_version.micro + 1}\"\n    )\n\n    from aider import __version__ as current_version\n\n    if new_version <= version.parse(current_version):\n        raise ValueError(\n            f\"New version {new_version} must be greater than the current version {current_version}\"\n        )\n\n    with open(\"aider/__init__.py\", \"r\") as f:\n        content = f.read()\n    updated_content = re.sub(r'__version__ = \".+?\"', f'__version__ = \"{new_version}\"', content)\n\n    print(\"Updating aider/__init__.py with new version:\")\n    print(updated_content)\n    if not dry_run:\n        with open(\"aider/__init__.py\", \"w\") as f:\n            f.write(updated_content)\n\n    git_commands = [\n        [\"git\", \"add\", \"aider/__init__.py\"],\n        [\"git\", \"commit\", \"-m\", f\"version bump to {new_version}\"],\n        [\"git\", \"tag\", f\"v{new_version}\"],\n        [\"git\", \"push\", \"origin\", \"--no-verify\"],","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/Aider-AI/aider/blob/5dc9490bb35f9729ef2c95d00a19ccd30c26339c/scripts/versionbump.py#L93-L129","documentation":"The second gate in scripts/versionbump.py: after format validation it imports aider.__version__ and requires the requested new_version to be strictly greater than the currently shipped version (new_version <= current raises). This prevents bumping to the same version (re-release) or backwards (rollback/typo like 0.1.0 instead of 1.0.0). Comparison uses packaging.version ordering, so 1.10.0 > 1.9.0 works correctly.","triggerScenarios":"Running versionbump.py with a value equal to or lower than the __version__ string in aider/__init__.py — e.g. re-running the same bump after a partial run already rewrote __init__.py, or requesting an older version to fix a bad release. Note the earlier pre-push checks (clean tree) would flag an already-modified __init__.py unless --force skipped them.","commonSituations":"Re-running the bump script after a failed/interrupted release (version already advanced, second run now 'not greater'); typo'd downgrade; forking from a fork whose __version__ is ahead.","solutions":["Check the current version: python -c \"from aider import __version__; print(__version__)\" and pass a strictly greater x.y.z.","If a previous bump already rewrote aider/__init__.py, git checkout aider/__init__.py to reset it before re-running (also clears the dirty-tree check).","For deliberate re-release of the same version, upstream policy requires a new patch number — bump micro instead."],"exampleFix":"# before\n$ python -c \"from aider import __version__; print(__version__)\"  # 0.72.0\n$ python scripts/versionbump.py 0.72.0  # ValueError: must be greater\n\n# after\n$ python scripts/versionbump.py 0.72.1","handlingStrategy":"validation","validationCode":"from packaging.version import Version, InvalidVersion\nfrom aider import __version__\n\ndef bump_is_valid(new_version: str) -> bool:\n    try:\n        return Version(new_version) > Version(__version__)\n    except InvalidVersion:\n        return False","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Read the shipped version first (python -c \"from aider import __version__; print(__version__)\") and bump strictly above it.","If a previous bump partially ran, git checkout aider/__init__.py before re-running.","Automate the bump in CI where the current version is known, avoiding manual typos."],"tags":["release-tooling","versioning","validation","scripts"],"backgroundTag":null,"analyzedSha":"5dc9490bb35f9729ef2c95d00a19ccd30c26339c","analyzedAt":"2026-08-15T05:40:10.498Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}