{"record":{"id":"7e621bd231730141","repo":"Aider-AI/aider","slug":"invalid-version-format-must-be-x-y-z-new-versio","errorCode":null,"errorMessage":"Invalid version format, must be x.y.z: {new_version_str}","messagePattern":"Invalid version format, must be x\\.y\\.z: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/versionbump.py","lineNumber":101,"sourceCode":"    )\n    parser.add_argument(\"--force\", action=\"store_true\", help=\"Skip pre-push checks\")\n\n    args = parser.parse_args()\n    dry_run = args.dry_run\n    force = args.force\n\n    # Perform checks before proceeding unless --force is used\n    if not force:\n        check_branch()\n        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:\")","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/Aider-AI/aider/blob/5dc9490bb35f9729ef2c95d00a19ccd30c26339c/scripts/versionbump.py#L83-L119","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\n$ python scripts/versionbump.py v1.2.3  # ValueError: Invalid version format\n\n# after\n$ python scripts/versionbump.py 1.2.3","handlingStrategy":"type-guard","validationCode":"import re\n\ndef is_release_version(s: str) -> bool:\n    return bool(re.fullmatch(r\"\\d+\\.\\d+\\.\\d+\", s.strip()))","typeGuard":"def is_release_version(s: str) -> bool:\n    return isinstance(s, str) and re.fullmatch(r\"\\d+\\.\\d+\\.\\d+\", s.strip()) is not None","tryCatchPattern":null,"preventionTips":["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."],"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"}