Skip to content

Fix cache manifest not saving: open MPQ writable in ProjectConfigBuilder#1176

Merged
Frotty merged 1 commit intowurstscript:masterfrom
Code-Fixxers:fix/mpq-cache-manifest-writable
Apr 1, 2026
Merged

Fix cache manifest not saving: open MPQ writable in ProjectConfigBuilder#1176
Frotty merged 1 commit intowurstscript:masterfrom
Code-Fixxers:fix/mpq-cache-manifest-writable

Conversation

@Donach
Copy link
Copy Markdown
Contributor

@Donach Donach commented Apr 1, 2026

Summary

ProjectConfigBuilder.apply() opens the target map MPQ with readOnly=true to save the updated cache manifest. The subsequent saveManifest()mpq.insertFile() call fails because JMPQ3's JMpqEditor.deleteFile() throws NonWritableChannelException when the editor is read-only.

This produces the warning:

Warning: Could not save manifest to MPQ: null

The null is because NonWritableChannelException() has no message by default.

This silently breaks the build caching system introduced in #1096 — every build becomes a full rebuild because the manifest is never persisted to the MPQ.

Fix

One-line change: readOnly from true to false at ProjectConfigBuilder.java:101 so the manifest can actually be written.

Call chain

  1. ProjectConfigBuilder.apply() line 101: MpqEditorFactory.getEditor(Optional.of(targetMap), true)read-only
  2. Line 104: ImportFile.saveManifest(mpq, manifest)
  3. ImportFile.saveManifest() line 224: mpq.insertFile(MANIFEST_MPQ_PATH, data)
  4. Jmpq3BasedEditor.insertFile() line 30: getEditor().deleteFile(filenameInMpq)throws NonWritableChannelException

Test plan

  • Build a map project — no more "Could not save manifest to MPQ: null" warning
  • Verify cache manifest is persisted inside the output .w3x

`ProjectConfigBuilder.apply()` opens the target map MPQ to save the
updated cache manifest, but passes `readOnly=true` to `getEditor()`.
The subsequent `saveManifest()` call tries to insert a file via
`mpq.insertFile()`, which calls `JMpqEditor.deleteFile()` internally.
JMPQ3 throws `NonWritableChannelException` (with a null message)
when the editor is read-only, resulting in:

  Warning: Could not save manifest to MPQ: null

This silently breaks the build caching system introduced in wurstscript#1096 —
every build becomes a full rebuild because the manifest is never
persisted.

Fix: change `readOnly` from `true` to `false` so the manifest can
actually be written.
@Frotty Frotty merged commit 3f740c9 into wurstscript:master Apr 1, 2026
3 checks passed
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