Aider-AI/aider · error · ValueError
New version {new_version} must be greater than the current v
Error message
New version {new_version} must be greater than the current version {current_version} What it means
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.
Source
Thrown at scripts/versionbump.py:111
check_working_directory_clean()
check_main_branch_up_to_date()
check_ok_to_push()
else:
print("Skipping pre-push checks due to --force flag.")
new_version_str = args.new_version
if not re.match(r"^\d+\.\d+\.\d+$", new_version_str):
raise ValueError(f"Invalid version format, must be x.y.z: {new_version_str}")
new_version = version.parse(new_version_str)
incremented_version = version.Version(
f"{new_version.major}.{new_version.minor}.{new_version.micro + 1}"
)
from aider import __version__ as current_version
if new_version <= version.parse(current_version):
raise ValueError(
f"New version {new_version} must be greater than the current version {current_version}"
)
with open("aider/__init__.py", "r") as f:
content = f.read()
updated_content = re.sub(r'__version__ = ".+?"', f'__version__ = "{new_version}"', content)
print("Updating aider/__init__.py with new version:")
print(updated_content)
if not dry_run:
with open("aider/__init__.py", "w") as f:
f.write(updated_content)
git_commands = [
["git", "add", "aider/__init__.py"],
["git", "commit", "-m", f"version bump to {new_version}"],
["git", "tag", f"v{new_version}"],
["git", "push", "origin", "--no-verify"],View on GitHub (pinned to 5dc9490bb3)
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.
Example fix
# before $ python -c "from aider import __version__; print(__version__)" # 0.72.0 $ python scripts/versionbump.py 0.72.0 # ValueError: must be greater # after $ python scripts/versionbump.py 0.72.1
Defensive patterns
Strategy: validation
Validate before calling
from packaging.version import Version, InvalidVersion
from aider import __version__
def bump_is_valid(new_version: str) -> bool:
try:
return Version(new_version) > Version(__version__)
except InvalidVersion:
return False Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid version format, must be x.y.z: {new_version_str}
- Could not find version header in HISTORY.md
- Could not find start of release history
- Could not find version header: {version_header}
- Invalid line_endings value: {line_endings}. Must be one of:
AI-assisted analysis of Aider-AI/aider@5dc9490bb3 (2026-08-15).
Data as JSON: /api/errors/3fe3c8f63644f069.
Report an issue: GitHub.