Dev.to WebDev 🛠 Dev 👁 0 📖 4 min read

Godot 4 web export for itch.io: the settings that stop failed to fetch

You export a Godot 4 game for the web, upload a file or two to itch, press Play, and the page says failed to fetch. The engine is not being mysterious. The browser asked for a file that is not there, or it opened a file:

Godot 4 web export for itch.io: the settings that stop failed to fetch

Lantern Walk running in Godot 4 at 1280 by 720, with a caption that the web export used threads off

You export a Godot 4 game for the web, upload a file or two to itch, press Play, and the page says failed to fetch. The engine is not being mysterious. The browser asked for a file that is not there, or it opened a file:// page that is not allowed to fetch anything, or you turned thread support on and the page is missing the headers that go with it.

This walkthrough exports a small Godot 4 project named Lantern Walk for the web, with thread support off, then checks every file the export actually wrote. The scene shot above is from that project, running in Godot 4.7.2 (Compatibility renderer) before the export. The export itself also ran in 4.7.2, and the file list below is from that folder, not from memory.

1. Turn thread support off, and export to a file

In Project > Export, add a Web preset. Two settings matter more than the rest:

  • Export path must be a file, for example build/web/index.html, not the folder build/web/.
  • Variant > Thread Support: off.

In export_presets.cfg:

[preset.0]

name="Web"
platform="Web"
runnable=true
export_path="build/web/index.html"

[preset.0.options]

variant/extensions_support=false
variant/thread_support=false
html/export_icon=true
html/canvas_resize_policy=2
html/focus_canvas_on_start=true

I also added a Linux preset next to it, so Ship Check had two paths to read. Export to a folder outside your Godot project if you can. I exported into res://build/web/, and Godot then wrote .import files next to the PNG files it had just created. Those .import files are not part of the upload.

2. Validate, then export

Ship Check's validator read the good presets and reported ok=true for both Web (build/web/index.html) and Linux (build/linux/lantern-walk.x86_64). I then pointed export_path at build/web/ on purpose. It failed with Web: export_path must be a file, not a directory. After a restore, it passed again.

The export command, which is also what Ship Check's local runner calls, is:

godot --headless --path . --export-release "Web" build/web/index.html

That command exited 0 in Godot 4.7.2. A Linux export with the same project also exited 0 and wrote lantern-walk.x86_64 plus lantern-walk.pck.

3. Upload every file the export wrote

This is the list from the build/web/ folder, with sizes, after the export I ran. The browser will fetch all of them.

File Size
index.html 5.4 KB
index.js 274 KB
index.pck 28 KB
index.wasm 38 MB
index.png 21 KB
index.icon.png 5.6 KB
index.apple-touch-icon.png 12 KB
index.audio.worklet.js 7.2 KB
index.audio.position.worklet.js 3.0 KB

The two that get left behind most often are index.pck and index.wasm. The HTML I exported even lists their exact sizes in its config: "fileSizes":{"index.pck":28040,"index.wasm":39514754}. If either one is missing, the engine asks for it and the browser reports failed to fetch.

A quick check I ran, serving the folder with Python's http.server:

  • Every file in the table above returned HTTP 200, with those exact byte counts.
  • I copied the folder, deleted only index.pck, and served it again. index.html and index.wasm still returned 200. index.pck returned 404. That is the bug, in one request.

Zip the nine files (not the .import files), upload the zip to itch, and set index.html as the playable file. Do not double-click index.html on your desktop and expect it to run. A file:// page is not allowed to fetch the .wasm and .pck next to it, and the error looks the same.

4. Threads, and when itch needs extra headers

The exported index.html from this run contains:

const GODOT_THREADS_ENABLED = false;

Leave it that way unless you know you need threads. If you turn Variant > Thread Support on, the page expects SharedArrayBuffer and the Cross-Origin Isolation headers that go with it. itch has a SharedArrayBuffer support checkbox on the project's HTML settings for that case. If the checkbox is off and threads are on, the page fails in a way that is easy to mistake for a missing file.

For this project, threads stayed off, so the itch page does not need that checkbox.

What I checked

  • Godot 4.7.2.stable, Compatibility renderer: the Lantern Walk scene ran and wrote the 1280x720 PNG above.
  • Ship Check validate() in 4.7.2: good Web and Linux presets passed; a Web path of build/web/ failed with "must be a file, not a directory"; the restored file passed.
  • --export-release "Web" exited 0 and wrote the nine files in the table, plus some .import leftovers because the output folder was inside the project. The HTML set GODOT_THREADS_ENABLED to false and listed the .pck and .wasm sizes.
  • --export-release "Linux" exited 0 and wrote lantern-walk.x86_64 (70 MB) and lantern-walk.pck (51 KB).
  • A local HTTP server returned 200 for every export file. The same server returned 404 for index.pck after I removed only that file.

Check the presets, then check the folder

Most "failed to fetch" reports are a missing .pck or .wasm, a file:// preview, or thread support left on. Ship Check (Godot Export CI MCP) will catch the path typo before you export, and it can run the export itself. After the export, look at the folder before you upload it. If you want to look inside the .pck you just built, PCK Inspector is the sibling tool for that.

Ship Check's editor dock, from the product's store shots

Get Ship Check here: Ship Check (Godot Export CI MCP)

Questions: [email protected]

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.