Quick answer: The host is stricter than your machine in a few specific ways. File names are case-sensitive there, so Player.png and player.png are different files. The game is served from a subfolder, so a path that starts with / points outside it. GitHub Pages skips files and folders whose names start with an underscore unless the site contains a .nojekyll file. And files that Git ignores were never uploaded. Open the Network tab, copy the URL of a failing request and compare it with what is really on the host.
The game runs from your local server. On GitHub Pages or itch.io the page loads, and then the console fills with failed requests for sprites, scripts or data files that are plainly in your project folder. Nothing in the game logic changed between the two. What changed is the file system, the URL the game lives at, and which files made the trip. This guide lists each cause with the sign that identifies it in the Network tab and the fix.
- What the console shows
- Why it works locally and fails on the host
- Find the cause in the Network tab
- Fix: file names
- Fix: absolute paths under a subfolder
- Fix: underscore files on GitHub Pages (.nojekyll)
- Fix: files that never reached the repository
- Fix: the itch.io zip
- Confirm the fix
- What reaches Bugnet when an asset is missing
- Related guides
- Frequently asked questions
What the console shows
On GitHub Pages, Chrome prints one or both of these for each missing file:
Failed to load resource: the server responded with a status of 404 ()
GET https://user.github.io/assets/player.png 404 (Not Found)
The empty parentheses in the first line are normal. GitHub Pages answers over HTTP/2, which has no status text for Chrome to print. A local server that speaks HTTP/1.1 gives 404 (Not Found) in the same place.
On itch.io the status is different. Its documentation states that a request for a path that does not point to a file returns 403, not 404, and that Chrome may show it as:
net::ERR_ABORTED 403
Read a 403 on itch.io as “file not found”. It is not a permissions problem you can fix in the project settings.
| Browser | Where a missing file shows up |
|---|---|
| Chrome, Edge | A console error for every failed request, as above |
| Firefox | The console reports failed scripts (Loading failed for the <script> with source “...”.) and media (HTTP load failed with status 404. Load of media resource ... failed.). Missing images and fetch requests appear in the Network tab only |
| Safari | Failed to load resource: the server responded with a status of 404 (Not Found) |
The 404 is rarely the only error. A missing engine script leads to “is not defined”, and on hosts that answer unknown URLs with a page, a missing script or JSON file leads to “Unexpected token ‘<’”. Fix the failed requests first and reload before reading anything else in the console.
Why it works locally and fails on the host
| Cause | Why your machine hides it | Sign in the failing URL |
|---|---|---|
| File name case does not match | Windows and macOS disks ignore case by default | The URL differs from the real file name only in upper and lower case |
Path starts with / | Your local server serves the game at the root of localhost | The repository name (or itch.io’s folder) is missing from the URL |
Name starts with _ on GitHub Pages | No Jekyll step runs locally | The URL contains a folder or file such as _assets or _framework |
| File ignored by Git or never committed | The file is on your disk | The URL is correct, and the file is not in the repository on github.com |
| File stored with Git LFS | Your checkout has the real file | Often no 404 at all: the request succeeds and the asset fails to decode |
| Bundler base path | The dev server rewrites paths for you | Hashed files requested from /assets/... at the domain root |
| Zip layout or limits on itch.io | You never unzip your own upload | Every request fails, or index.html itself is missing |
| Spaces and special characters in names | Local tools are forgiving | The URL is cut short at a # or ?, or contains % sequences |
Find the cause in the Network tab
- Open the deployed game with DevTools open, go to the Network tab, tick Disable cache and reload.
- Sort by the Status column. Click the first red row and copy its Request URL from the Headers tab.
- Look at the folder part of the URL. Your game lives at something like
https://user.github.io/my-game/. If the failing URL ishttps://user.github.io/assets/player.png, withoutmy-game, the path in your code starts with/or climbs out with../. - If the folder is right, compare the file name with the repository letter by letter, using the first command below.
- If the file is not in the repository at all, ask Git why with the second command.
This lists the tracked files that match, ignoring case, so a difference in case is visible:
git ls-files | grep -i "player.png"
If it prints nothing, the file was never committed. This prints the .gitignore line responsible, or nothing if the file is simply not added yet:
git check-ignore -v assets/player.png
For itch.io, inspect the archive you uploaded instead of the repository:
unzip -l game.zip
The listing is exactly what the host has: the folder layout, the case of every name and the file count.
Fix: file names
Upper and lower case
GitHub Pages and itch.io both serve files from case-sensitive systems. itch.io’s documentation says so directly and gives the example that a file named Hello.png cannot be loaded as hello.png. The code and the file have to agree exactly, extension included (.PNG from a camera or an export tool is a common one).
Renaming in Explorer or Finder is often not enough, because Git on a case-insensitive disk does not notice a change that is only in case. Rename through Git so the change is recorded:
git mv assets/Player.png assets/player-tmp.png
git mv assets/player-tmp.png assets/player.png
git commit -m "Fix file name case"
The two steps through a temporary name work on every Git version and file system. Then pick a rule that makes the problem impossible: lowercase names for every asset and folder, with hyphens for word breaks.
Spaces and special characters in file names
A URL gives several characters a meaning of their own. In a path written by hand they silently change which file is requested:
#starts the fragment. A request forsfx/hit#1.wavasks the server forsfx/hit.?starts the query string, sowhat?.pngis requested aswhat.%introduces an escape sequence, so100%.pngis not a valid URL as written.- Spaces are sent as
%20. That works when every tool in the chain agrees, and they often do not.
Rename the files to lowercase letters, digits, hyphens, underscores and dots. If names come from players or from an editor and cannot be controlled, encode each path segment with encodeURIComponent() before building the URL.
Fix: absolute paths under a subfolder
A GitHub project site is published at https://<owner>.github.io/<repository>/, and itch.io hosts each upload in its own subdirectory on a separate file host. In both cases the root of the domain is not your game. With the page at https://user.github.io/my-game/:
| Path in your code | What the browser requests | Result |
|---|---|---|
/assets/player.png | https://user.github.io/assets/player.png | 404 |
assets/player.png | https://user.github.io/my-game/assets/player.png | Loads |
./assets/player.png | https://user.github.io/my-game/assets/player.png | Loads |
../assets/player.png | https://user.github.io/assets/player.png | 404 |
Remove the leading slash everywhere: script and link tags, image sources, loader calls, and URLs inside JSON such as tilemap and atlas files.
<!-- Broken on a subfolder -->
<script src="/js/game.js"></script>
<!-- Works anywhere -->
<script src="js/game.js"></script>
Two details about what “relative” is relative to. A path passed to fetch, an image src or an engine loader is resolved against the page, not against the JavaScript file that contains it. A url() in a stylesheet is resolved against the stylesheet. To load something that sits next to a module, whatever page includes it, build the URL from the module’s own address:
const levelUrl = new URL("./levels/level1.json", import.meta.url);
const level = await fetch(levelUrl).then((r) => r.json());
The bundler’s base path
Build tools write absolute URLs into the built index.html unless told otherwise. Vite’s default base is /, so the build requests /assets/index-4f3a1c.js from the domain root. Set a relative base and the same build works on a project site, on itch.io and at a domain root:
// vite.config.js
import { defineConfig } from "vite";
export default defineConfig({
base: "./",
});
Files in Vite’s public folder are copied as they are and are not rewritten, so reference them through the base instead of with a leading slash:
const url = import.meta.env.BASE_URL + "levels/level1.json";
Other bundlers have the same setting under another name, such as output.publicPath in webpack. Also check which folder you are publishing. The deployable game is the build output (dist for Vite), not the project root that holds the source.
Fix: underscore files on GitHub Pages (.nojekyll)
When GitHub Pages publishes from a branch, it runs the files through Jekyll by default. GitHub’s documentation lists what Jekyll does not publish: files and folders whose names start with _, . or #, names that end with ~, and folders named node_modules or vendor. Game builds collide with that list often. Some toolchains emit folders such as _framework, people keep libraries in vendor/, and a script tag that points into node_modules/ works on your disk and nowhere else.
Turn Jekyll off by adding an empty file named .nojekyll at the top level of the folder Pages publishes (the branch root, or /docs if you chose that):
touch .nojekyll
git add .nojekyll
git commit -m "Disable Jekyll on GitHub Pages"
git push
In PowerShell, create the file with New-Item .nojekyll -ItemType File. If a script produces the published folder, add the file as a step after the build, because a clean build will delete it. A site deployed by your own GitHub Actions workflow is uploaded as built and does not go through Jekyll unless the workflow runs it.
node_modules has a second problem that .nojekyll does not solve: it is normally in .gitignore, so it is not in the repository. Copy the library file you need into the project, or use a bundler.
Fix: files that never reached the repository
GitHub Pages can only publish what was pushed. Three things keep files out.
.gitignorerules. Templates often ignoredist/,build/andBuild/, which are exactly the folders a web export lands in.git check-ignore -v, shown above, names the rule. Either publish from a workflow that runs the build, or commit the output to a dedicated branch.- The wrong publishing source. Under Settings > Pages > Build and deployment, a branch source can serve only the repository root or
/docs. Ifindex.htmlis indist/, Pages is serving the folder above it. GitHub’s troubleshooting page adds that the entry file must be namedindex.htmlin exactly that case, at the top level of the source. - Git LFS. GitHub’s documentation says Git LFS cannot be used with GitHub Pages sites. What sits in the Git tree for an LFS file is a small text pointer that begins with
version https://git-lfs.github.com/spec/v1, and that is typically what gets published. The request then succeeds, and the engine fails to decode an image, sound or.wasmfile that is about 130 bytes of text. Download the URL and look at the first bytes to confirm:
curl -s https://user.github.io/my-game/assets/music.ogg | head -c 120
To fix it, take the published assets out of LFS, or deploy with a GitHub Actions workflow whose checkout step sets lfs: true, so the real files are present when the site is uploaded.
After any push, wait for the deployment to finish before you test. The Actions tab shows the Pages run, and a reload before it completes shows you the previous version.
Fix: the itch.io zip
itch.io’s HTML5 documentation sets these requirements for the uploaded archive:
- It must be a ZIP file (not
.raror.7z) and must contain a file calledindex.html, which is the entry point. - No more than 1,000 files after extraction.
- No file path longer than 240 characters.
- No more than 500 MB in total after extraction, and no single file over 200 MB.
- File names are case-sensitive and should be encoded as UTF-8.
- Paths must be relative, because the project is hosted in a subdirectory.
Zip the contents of the build folder, not the folder itself, so that index.html is at the top level of the archive and no path is longer than it needs to be:
cd build
zip -r ../game.zip .
unzip -l ../game.zip | head
The listing should show index.html with no folder in front of it, and forward slashes in every path. Some older Windows zip tools write backslashes into the archive. A Linux host then extracts a single file literally named assets\player.png and no assets folder, and every asset request fails. If you see backslashes in the listing, recreate the archive with another tool.
The file count limit catches engines that export thousands of small files. Pack them (texture atlases, a single data file, a bundled script) instead of asking for the limit to be raised. More on the upload itself is in the guide to a web game not loading after uploading the zip to itch.io.
Confirm the fix
- Reload the deployed game with the cache disabled. The Network tab should have no red rows, and the Status column should read 200 for every asset.
- Open the URL in a private window to rule out a cached copy of the old page.
- Play past the first screen. Assets that load later (level two, the ending music) fail later, and a clean title screen proves little.
- To catch case errors before uploading, serve the build from a case-sensitive system once: a Linux machine, WSL’s own file system on Windows, or a CI job.
What reaches Bugnet when an asset is missing
A failed request by itself produces no report. The Bugnet Web SDK listens for uncaught errors and unhandled promise rejections on window, and a 404 on an image, script or sound is neither: it raises an error event on the element, which does not travel up to window. What the SDK does file is the consequence, when there is one: the uncaught exception from code that used the missing asset, once per session, with the last 50 console lines, a canvas screenshot, the user agent and the game version. A game that shows a blank sprite and carries on reports nothing.
You can make the cause visible in those console lines. A listener in the capture phase sees failed loads from tags, and anything it logs with console.error is included in the next report:
window.addEventListener("error", (event) => {
const el = event.target;
if (el && el !== window && (el.src || el.href)) {
console.error("Asset failed to load:", el.src || el.href);
}
}, true);
For assets loaded with fetch, check response.ok in your loader and call Bugnet.reportBug("Asset failed to load", url, { category: "other" }). Reports with the same title stack into one entry with an occurrence count. If the missing file is the game’s own main script, nothing runs and nothing reports, which is the argument for testing the deployed URL yourself after every upload. Setup is in the SDK docs.
Related guides
- How to Fix a Web Game Not Loading After Uploading the Zip to itch.io
- How to Fix “Uncaught SyntaxError: Unexpected token ‘<’” in a Web Game
- How to Fix “Uncaught ReferenceError: is not defined” in a Web Game
- How to Fix “Mixed Content” Errors in a Web Game
- How to Collect Bug Reports From Your itch.io Players
Frequently asked questions
Why does my web game work locally but return 404 on GitHub Pages?
The usual reasons are a file name whose case differs from the code, a path that starts with a slash while the site is served from a repository subfolder, a file or folder starting with an underscore that the Jekyll step skipped, or a file that .gitignore kept out of the repository. The Request URL of the failing row in the Network tab tells you which.
What does the .nojekyll file do?
It tells GitHub Pages not to run the site through Jekyll when publishing from a branch. Without it, files and folders whose names start with an underscore, a dot or a hash sign, and folders named node_modules or vendor, are left out of the published site. It is an empty file at the top level of the published folder.
Why do I get 403 errors for my game files on itch.io?
itch.io returns 403 where most servers return 404, so a 403 on an asset means the file was not found at that path. Check the case of the file name and make sure the path is relative, because the game is hosted in a subdirectory and the server is case-sensitive.
Why are my paths wrong on a GitHub project site?
A project site is published at owner.github.io/repository/, so a path beginning with a slash points at the domain root, outside your game. Use relative paths without the leading slash, and set your bundler's base path to ./ so the built files are referenced relatively.
Can I use Git LFS files on GitHub Pages?
No. GitHub's documentation states that Git LFS cannot be used with GitHub Pages sites. The published file is typically the small text pointer, so the request succeeds and the image, sound or WebAssembly file then fails to decode.
Your machine forgives things a web host does not: case, leading slashes and files that only exist on your disk. Copy the failing URL from the Network tab and compare it with the files that were actually uploaded.