Aider-AI/aider · error · ValueError
Could not find version header in HISTORY.md
Error message
Could not find version header in HISTORY.md
What it means
scripts/update-history.py maintains HISTORY.md from git history. get_latest_version_from_history greps HISTORY.md for the regex '### Aider v(\d+\.\d+\.\d+)' to find the most recent release header; if no header matches, it raises ValueError. Note re.search returns the FIRST match in file order, so this assumes the newest version appears first. The failure means HISTORY.md lacks any correctly-formatted '### Aider v x.y.z' heading — uncommitted initial file, mangled formatting, or wrong working directory (the file is opened by relative path).
Source
Thrown at scripts/update-history.py:19
#!/usr/bin/env python3
import os
import re
import subprocess
import sys
import tempfile
from history_prompts import history_prompt
def get_latest_version_from_history():
with open("HISTORY.md", "r") as f:
history_content = f.read()
# Find most recent version header
match = re.search(r"### Aider v(\d+\.\d+\.\d+)", history_content)
if not match:
raise ValueError("Could not find version header in HISTORY.md")
return match.group(1)
def run_git_log():
latest_ver = get_latest_version_from_history()
cmd = [
"git",
"log",
"--pretty=full",
f"v{latest_ver}..HEAD",
"--",
"aider/",
":!aider/website/",
":!scripts/",
":!HISTORY.md",
]
result = subprocess.run(cmd, capture_output=True, text=True)
return result.stdoutView on GitHub (pinned to 5dc9490bb3)
Solutions
- Ensure at least one heading exactly matches '### Aider v0.0.0'-style format — three hashes, 'Aider v', dotted triple — and that the newest release is the first such heading.
- Run the script from the repository root (it opens 'HISTORY.md' relatively).
- Restore/undo any heading-style edits to HISTORY.md (git checkout HISTORY.md).
Example fix
# before ## Aider 1.2.3 # wrong level, missing 'v' # after ### Aider v1.2.3
Defensive patterns
Strategy: validation
Validate before calling
import re
def history_has_version_header(path="HISTORY.md") -> bool:
text = open(path).read()
return re.search(r"### Aider v\d+\.\d+\.\d+", text) is not None Prevention
- Keep the newest release as the first '### Aider vX.Y.Z' heading, exact format (three #, 'v', dotted triple).
- Run release scripts from the repo root — HISTORY.md is opened by relative path.
- Don't restyle changelog headings without updating the regex expectations.
When it happens
Trigger: Running scripts/update-history.py from a directory without HISTORY.md (FileNotFoundError would hit first only if the file is absent; a present-but-unformatted file reaches this raise), or with headers edited to '### Aider 1.2.3' (missing 'v'), '## Aider v1.2.3' (wrong level), or extra text breaking the exact '### Aider vX.Y.Z' pattern.
Common situations: Maintainer/fork workflows: reformatting HISTORY.md, converting to another heading style, running the script from a subdirectory, or a fresh clone of a fork whose HISTORY.md was trimmed.
Related errors
- Could not find start of release history
- Could not find version header: {version_header}
- Invalid version format, must be x.y.z: {new_version_str}
- New version {new_version} must be greater than the current v
AI-assisted analysis of Aider-AI/aider@5dc9490bb3 (2026-08-15).
Data as JSON: /api/errors/0ab6bd2ded8f0008.
Report an issue: GitHub.