{"record":{"id":"f347ef9613af2ef5","repo":"Aider-AI/aider","slug":"could-not-find-start-of-release-history","errorCode":null,"errorMessage":"Could not find start of release history","messagePattern":"Could not find start of release history","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/update-history.py","lineNumber":72,"sourceCode":"\n\ndef main():\n    aider_args = sys.argv[1:]\n\n    # Get the git log and diff output\n    log_content = run_git_log()\n    diff_content = run_git_diff()\n\n    # Extract relevant portion of HISTORY.md\n    latest_ver = get_latest_version_from_history()\n    with open(\"HISTORY.md\", \"r\") as f:\n        history_content = f.read()\n\n    # Find the section for this version\n    version_header = f\"### Aider v{latest_ver}\"\n    start_idx = history_content.find(\"# Release history\")\n    if start_idx == -1:\n        raise ValueError(\"Could not find start of release history\")\n\n    # Find where this version's section ends\n    version_idx = history_content.find(version_header, start_idx)\n    if version_idx == -1:\n        raise ValueError(f\"Could not find version header: {version_header}\")\n\n    # Find the next version header after this one\n    next_version_idx = history_content.find(\"\\n### Aider v\", version_idx + len(version_header))\n    if next_version_idx == -1:\n        # No next version found, use the rest of the file\n        relevant_history = history_content[start_idx:]\n    else:\n        # Extract just up to the next version\n        relevant_history = history_content[start_idx:next_version_idx]\n\n    # Save relevant portions to temporary files\n    with tempfile.NamedTemporaryFile(mode=\"w\", delete=False, suffix=\".log\") as tmp_log:\n        tmp_log.write(log_content)","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/Aider-AI/aider/blob/5dc9490bb35f9729ef2c95d00a19ccd30c26339c/scripts/update-history.py#L54-L90","documentation":"Later in scripts/update-history.py, after collecting git log/diff it locates the editable region of HISTORY.md via the literal anchor string '# Release history'. If find() returns -1 the script raises ValueError because everything it does (extracting the current version's section, splicing the new entry) is anchored to that heading. The anchor is exact and case-sensitive; any rewording ('## Release History', 'Release notes') breaks it.","triggerScenarios":"Running update-history.py against a HISTORY.md that lacks a line containing exactly '# Release history' — renamed section, different heading level ('## Release history'), trailing whitespace is tolerated but case changes are not, or the section was deleted during a rewrite.","commonSituations":"Maintainers rewriting/reorganizing HISTORY.md and renaming the anchor heading; forks that restyled the changelog.","solutions":["Restore an exact line '# Release history' in HISTORY.md above the version entries.","Keep the newest '### Aider vX.Y.Z' entry after that anchor so the version lookup also succeeds.","git checkout HISTORY.md if the change was accidental."],"exampleFix":"# before\n## Release History\n\n### Aider v1.2.3\n\n# after\n# Release history\n\n### Aider v1.2.3","handlingStrategy":"validation","validationCode":"def history_has_anchor(path=\"HISTORY.md\") -> bool:\n    return \"# Release history\" in open(path).read()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never rename the literal anchor line '# Release history' — it is load-bearing for the release script.","Add a CI lint that asserts both the anchor and a version header exist before running update-history.py."],"tags":["release-tooling","markdown","changelog","anchor-string","scripts"],"backgroundTag":null,"analyzedSha":"5dc9490bb35f9729ef2c95d00a19ccd30c26339c","analyzedAt":"2026-08-15T05:40:10.498Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}