Aider-AI/aider · error · ValueError
Invalid version format, must be x.y.z: {new_version_str}
Error message
Invalid version format, must be x.y.z: {new_version_str} What it means
scripts/versionbump.py enforces strict semver-triple input: args.new_version must fully match r'^\d+\.\d+\.\d+$' before anything is written. Anything else — '1.2', '1.2.3.4', 'v1.2.3', '1.2.3-rc1', leading/trailing spaces — raises ValueError with the offending string. The check runs after the pre-push guards (branch, clean tree, up-to-date main) unless --force was passed, so with --force this format error is the first thing you hit.
Source
Thrown at scripts/versionbump.py:101
)
parser.add_argument("--force", action="store_true", help="Skip pre-push checks")
args = parser.parse_args()
dry_run = args.dry_run
force = args.force
# Perform checks before proceeding unless --force is used
if not force:
check_branch()
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:")View on GitHub (pinned to 5dc9490bb3)
Solutions
- Pass exactly three dot-separated integers, no 'v' prefix, no pre-release/build suffix: python scripts/versionbump.py 1.2.3.
- Strip the prefix in your release wrapper if you copy tag names: ver=${tag#v}.
- Keep pre-release handling out of this script — it only supports final x.y.z releases.
Example fix
# before $ python scripts/versionbump.py v1.2.3 # ValueError: Invalid version format # after $ python scripts/versionbump.py 1.2.3
Defensive patterns
Strategy: type-guard
Validate before calling
import re
def is_release_version(s: str) -> bool:
return bool(re.fullmatch(r"\d+\.\d+\.\d+", s.strip())) Type guard
def is_release_version(s: str) -> bool:
return isinstance(s, str) and re.fullmatch(r"\d+\.\d+\.\d+", s.strip()) is not None Prevention
- Strip 'v' prefixes and pre-release suffixes before invoking versionbump.py.
- Validate against ^\d+\.\d+\.\d+$ in your release wrapper so failures happen with a clear message.
When it happens
Trigger: python scripts/versionbump.py <arg> with a non x.y.z argument: 'v1.2.3' (leading v), '1.2.3-beta' (pre-release tag), '1.2' (short), or a typo like '1.2..3'. Regex is anchored (^...$) and numeric-only, so any deviation raises.
Common situations: Maintainers cutting releases who habitually type 'v1.2.3' matching git tag style, or copy pre-release identifiers from semver docs; the script's subsequent version.parse and the aider/__init__.py rewrite expect a bare dotted triple.
Related errors
- New version {new_version} must be greater than the current v
- 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/7e621bd231730141.
Report an issue: GitHub.