Skip to content

fix: stop submitting the whole ever-growing CHANGELOG.md as the Modrinth version body - #20

Merged
KP2048 merged 1 commit into
1.21.xfrom
worktree-fix-modrinth-changelog-length
Aug 13, 2026
Merged

fix: stop submitting the whole ever-growing CHANGELOG.md as the Modrinth version body#20
KP2048 merged 1 commit into
1.21.xfrom
worktree-fix-modrinth-changelog-length

Conversation

@KP2048

@KP2048 KP2048 commented Aug 13, 2026

Copy link
Copy Markdown
Member

Summary

`publishModrinth` was failing with:

EndpointException(error=invalid_input, description=Error while validating input: Field version_body failed validation with error: length)

`publisher { changelog = file("CHANGELOG.md") }` submits that file's entire content as the version body on every publish. `generate_release_notes.py`'s `update_changelog()` only ever prepends - CHANGELOG.md accumulates every release's notes forever, and Modrinth's `version_body` has a length limit (~65536 chars) that a large enough cumulative history eventually exceeds. CurseForge tolerated the same payload; Modrinth didn't.

A second, related bug made this worse in practice: the pre-publish flow (`generateChangelog`) passes `--new-tag` as the intended, not-yet-real version. Retrying a failed local publish re-runs it with the exact same range/version and got a fresh duplicate section prepended every single time instead of regenerating the existing one in place - which is exactly how a local CHANGELOG.md ends up with the same version's section repeated many times over.

Fixes

  • `generate_release_notes.py`: `update_changelog()` now replaces the existing top section instead of prepending a duplicate when it's for the same version already at the top of the file (safe/correct for the real post-tag flow too, where each version is genuinely only ever generated once).
  • New `--latest-path`: writes just this release's own rendered body (no accumulated history), independent of whatever's already in CHANGELOG.md.
  • `build.gradle.kts`: `generateChangelog` now also writes `build/latest-changelog.md`; `publisher.changelog` points there instead of `CHANGELOG.md`.

Verification

A single generated release covering this repo's entire history (66 entries, worst case - no previous tag) renders to ~11KB, comfortably under Modrinth's limit. Re-running the script twice for the same version now leaves exactly one section in CHANGELOG.md instead of two.

🤖 Generated with Claude Code

…nth version body

publishModrinth started failing with:
  EndpointException(error=invalid_input, description=Error while
  validating input: Field version_body failed validation with error: length)

publisher { changelog = file("CHANGELOG.md") } submits that file's entire
content as the version body on every publish. generate_release_notes.py's
update_changelog() only ever prepends - CHANGELOG.md accumulates every
release's notes forever, and Modrinth's version_body has a length limit
(~65536 chars) that a large enough cumulative history eventually exceeds
(CurseForge tolerated it; Modrinth didn't).

A second, related bug made this worse in practice: the pre-publish flow
(generateChangelog) passes --new-tag as the *intended*, not-yet-real
version - retrying a failed local publish re-runs it with the exact same
range/version and got a fresh duplicate section prepended every time
instead of regenerating the existing one in place.

Fixes:
- generate_release_notes.py: update_changelog() now replaces the existing
  top section instead of prepending a duplicate when it's for the same
  version already at the top of the file (safe/correct for the real
  post-tag flow too, where each version is genuinely only ever generated
  once).
- New --latest-path: writes just this release's own rendered body (no
  accumulated history), completely independent of whatever's already in
  CHANGELOG.md.
- build.gradle.kts: generateChangelog now also writes
  build/latest-changelog.md; publisher.changelog points there instead of
  CHANGELOG.md.

Verified: a single generated release covering this repo's entire history
(66 entries, worst case - no previous tag) renders to ~11KB, comfortably
under Modrinth's limit. Re-running the script twice for the same version
now leaves exactly one section in CHANGELOG.md instead of two.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 13, 2026 05:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@KP2048
KP2048 merged commit c4f6d46 into 1.21.x Aug 13, 2026
5 of 6 checks passed
@KP2048
KP2048 deleted the worktree-fix-modrinth-changelog-length branch August 13, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants