When Something Goes Wrong
Everyone who writes a game makes mistakes: a missing comma, a name spelled two ways. Monogatari points out many of them, and this page lists the ones it doesn’t, so you can recognize them all.
Where Monogatari tells you
Error dialogs while you play
When a statement can’t run, because it names a character, a sprite or a label that doesn’t exist, a dialog opens when the story reaches it:

The dialog says what’s wrong in its title, then lists the details:
- The names that exist, such as Available Sprites, so you can see the right spelling.
- The statement as you wrote it.
- The label and the step: where the statement is. Steps are counted from 0, so Step: 12 is the thirteenth statement of the label
'Start'.
Fix the name in js/script.js, and save. To close the dialog, scroll down to the Ok button at its bottom. The game is still playable: the next click goes on with the statement after the one that failed (Yui goes on talking, without the new expression), and Back steps over it. Reload the page to try your fix.
The browser console
The console is a panel of the browser where web pages write messages for their developers. Monogatari writes a lot there while you make your game: every statement it runs, every warning and every error, including the ones that never get a dialog. Players don’t see it unless they open it.
To open it, on a computer:
| Browser | Windows and Linux | macOS |
|---|---|---|
| Chrome | Ctrl+Shift+J | Cmd+Option+J |
| Edge | Ctrl+Shift+J | Cmd+Option+J |
| Firefox | Ctrl+Shift+K | Cmd+Option+K |
| Safari | Once: Safari › Settings… › Advanced, and check Show features for web developers. Then Cmd+Option+C. |
The console opens at the side or the bottom of the window. Errors are red, and warnings are yellow. Next to each message, the console names the file and the line it comes from.
NOTE
Browsers on phones and tablets have no console. There, the dialogs are what you have, and the mistakes on this page that show no dialog are worth checking one by one.
A few messages are normal, and you can ignore them:
- Persistent Storage permission has been denied, in Chrome.
- There was no settings saved, the first time a game opens in a browser.
- Opened from the file: Offline play is off: browsers only run the service worker (service-worker.js) for a game served over https, or from localhost or 127.0.0.1 on your own computer, not for an index.html opened from a file. Offline play needs the game served.
The game doesn’t start: a comma, a quote or a bracket
This is the most common mistake. You changed js/script.js, reloaded, and the game won’t start.
A typo stops the browser from running js/script.js at all, so Monogatari never received your script. Your labels are still in the file. A dialog titled There is a mistake in js/script.js opens. It names the file, says what the mistake means for your game, and, when the game is served, gives the line and the browser’s message:


When you close it, the page stays blank, without the main menu, until you fix the typo.
The console always names the file and the line, in Chrome and Firefox, opened from the file or served: when the dialog says Not given, look there. The line is where the browser noticed the problem. The mistake is on that line or the one before it: for a missing comma, it’s usually the line before.
The usual causes:
// A missing comma after a statement
'The bell rings at the end of the drawing class.'
'show scene afternoon with fadeIn',
// An apostrophe between single quotes
'y Oh, you're still here too?',
// A curly quote around a statement
‘y Hey, look.’,// Fixed
'The bell rings at the end of the drawing class.',
'show scene afternoon with fadeIn',
// Fixed: double quotes around the line
"y Oh, you're still here too?",
// Fixed: straight quotes
'y Hey, look.',A missing bracket does the same: every { needs its }, and every [ its ]. Look first at the last thing you changed. A code editor helps here, because its colors change at the exact place a quote or a bracket goes wrong.
A typo in js/main.js
A typo in js/main.js opens There is a mistake in js/main.js, and the page stays blank, light gray, without the main menu: js/main.js is the file that starts the game. Fix it the same way as a typo in js/script.js.
A name is misspelled
A misspelled name for a character in show character, for one of its sprites, or for a label in jump, opens a dialog when the story reaches it, as at the top of this page. Three kinds of typo get past the dialogs:
- A misspelled background.
'show scene afternon'turns the screen black where the palace should be. Monogatari doesn’t know a background calledafternon, so it tries to use the word as a color, and there’s no such color. - A misspelled instruction.
'shwo scene afternoon'isn’t an instruction Monogatari knows, so the text box shows the words shwo scene afternoon as narration. Instructions are case-sensitive too:'Show scene afternoon'has the same problem. - A misspelled character id in a line.
'yu Hey, look.'shows yu Hey, look. as narration, with no name above it.
A picture doesn’t show
The background turns black, or a character doesn’t appear, and there’s no dialog. The file isn’t where Monogatari looks for it:
- The folder: backgrounds go in
assets/scenes/, and a character’s sprites inassets/characters/, inside the character’sdirectory(assets/characters/yui/for Yui). - The file name: it must match what you wrote, capitals and extension included:
happy.pngisn’tHappy.pngorhappy.PNG. Some computers ignore the difference, and web hosts don’t, so a game that works on your computer can lose pictures online.
On a computer, the console names the file it couldn’t find, with an error such as Failed to load resource: net::ERR_FILE_NOT_FOUND in Chrome.
A sound doesn’t play
The game goes on, but a music, a sound or a voice is silent, and a dialog says The music “theme” could not be loaded. when the story reaches its play statement. The dialog shows the file it looked for. When the game is served, a first dialog, Some of your game’s files could not be preloaded, opens after the loading screen and names the file too. The file isn’t there, its name doesn’t match, or the browser can’t play its format:
- The name in the
playstatement must be one you declared inmonogatari.assets('music', { … })(or'sounds','voices'). - The folder:
assets/music/for music,assets/sounds/for sounds,assets/voices/for voices. - The file name, capitals and extension included, the same way as for a picture. MP3 plays in every current browser.
Press Ok in the dialog to play on, and reload the page once you’ve fixed it to hear the sound.
Still stuck
Troubleshooting covers more problems, and Diagnosing Errors explains every error dialog by its title. If none of them helps, ask for help: describe what you see, and paste the part of your script it’s about.
Next
Share your game: put it online.