Skip to content

Fail clearly on empty downloads; friendlier create errors (#43) - #57

Merged
CaYatur merged 1 commit into
mainfrom
fix/mohist-empty-download
Jul 24, 2026
Merged

Fail clearly on empty downloads; friendlier create errors (#43)#57
CaYatur merged 1 commit into
mainfrom
fix/mohist-empty-download

Conversation

@CaYatur

@CaYatur CaYatur commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Closes #43. Part of the provider-reliability pass (#44).

Problem

Mohist creation surfaced two baffling messages:

  • Checksum mismatch (got e3b0c442…, expected 5ad74546…)e3b0c442… is the SHA-256 of zero bytes, i.e. the mirror returned a 200 with an empty body and the "corruption" error hid the real cause.
  • no-mohist-build — the upstream API lists Minecraft versions that currently have no build. Verified live: 1.20.6 and 1.21.4 both return "builds":[].

Fix

  • net.ts downloadFile: after streaming, a 0-byte body is now a hard empty-download: <url> error (destination removed) before the checksum step, so an empty response never masquerades as a checksum mismatch. This guards every provider, not just Mohist.
  • CreateView: map short backend codes to human messages — no-*-build ("no build for this version, pick another"), empty-download, folder-exists, installer-args-not-found — instead of showing the raw code. Unknown codes still pass through. New en/tr strings.
  • MSMS_SMOKE_WIZARD: a throwaway local HTTP server returns a 0-byte 200; downloadFile must throw empty-download (not a checksum error) and leave no partial file.

Scope & honesty

This does not make Mohist downloads succeed where the upstream mirror serves an empty body or a version has no build — it turns those failures into clear, actionable messages. The Mohist provider already matches the current v2 API (number / fileSha256 / url confirmed against live responses), so no field remapping was needed. A fallback-on-empty retry to originUrl is a possible future follow-up but cannot be verified from this environment (direct jar downloads are unreachable here), so it is intentionally left out.

Verify

  • typecheck, build — pass.
  • MSMS_SMOKE_WIZARD PASS, including the new empty-download guard block.
  • The Mohist API shapes above were checked against live mohistmc.com/api/v2 responses; the actual jar transfer was not exercised here.

🤖 Generated with Claude Code

Fail clearly on empty downloads; friendlier create errors (#43)

Mohist creation surfaced two baffling messages. The tell was a checksum
mismatch reporting got=e3b0c442… — the SHA-256 of ZERO bytes — i.e. the
mirror returned a 200 with an empty body and the "corruption" error hid
the real cause. The other, no-mohist-build, fires because the upstream
API lists Minecraft versions that currently have no build (verified:
1.20.6 and 1.21.4 return "builds":[]).

- net.ts downloadFile: after streaming, a 0-byte body is now a hard
  `empty-download: <url>` error (dest removed) *before* the checksum step,
  so an empty response never masquerades as a checksum mismatch. Guards
  every provider, not just Mohist.
- CreateView: map short backend codes to human messages —
  no-*-build ("no build for this version, pick another"), empty-download,
  folder-exists, installer-args-not-found — instead of showing the raw
  code. Unknown codes still pass through. New en/tr strings.
- WIZARD smoke: a local 0-byte HTTP 200 makes downloadFile throw
  empty-download (not a checksum error) and leave no partial file.

Scope/honesty: this does NOT make Mohist downloads succeed where the
upstream mirror is empty or a version has no build — it turns those
failures into clear, actionable messages. The Mohist provider already
matches the current v2 API (number/fileSha256/url verified live), so no
field remapping was needed; a fallback-on-empty retry to originUrl is a
possible future follow-up but is unverifiable from here.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@
Copilot AI review requested due to automatic review settings July 24, 2026 15:37
@CaYatur
CaYatur merged commit dc74720 into main Jul 24, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

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.

@CaYatur
CaYatur deleted the fix/mohist-empty-download branch July 24, 2026 15:37
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.

Mohist creation fails: no-mohist-build and empty-download checksum mismatch

2 participants