Look for your symptom, read the message, apply the fix. Messages are quoted from the code exactly; the part that depends on your script (an id, a number) is written between < and > or as an ellipsis. The limits behind them are in Limits.
Where the errors are
- The Mods page lists every mod folder with its state: active, failed (not loaded: invalid declaration, an error at load or in
setup) or disabled (turned off by the player, or stopped after repeated errors). A failed or disabled mod shows its reason, and a Messages list shows what the scripts logged (log.*) and every error. - Reload restarts the mods host and retries every mod that failed. The game does not watch your files: after an edit, press Reload. Reload, install and uninstall are refused during a play ("Mods cannot be reloaded during a play").
- The errors of a map script appear in a banner at the map launch and in the same message list; the map is then played with the skin alone.
console.loggoes to the process's standard error, not to the Mods page. Uselog.info,log.warn,log.error.
The mod is not listed
| Symptom | Cause | Fix |
|---|---|---|
| No card at all | The game reads one folder per mod in its mods folder. A folder is a mod only if it contains main.ts or index.ts at its root. |
Open the folder from the Mods page (Open folder) and check the layout: mods/<your-mod>/main.ts, not mods/<your-mod>/<another-folder>/main.ts. |
| No card, the folder is right | A folder whose name starts with . is ignored (the installer's staging folders). A folder whose name starts with editor- is skipped by the game: it belongs to the map editor. |
Rename the folder. |
| The card shows after a restart only | Nothing reloads by itself. | Press Reload on the Mods page. |
| A mod just installed does nothing | A mod that arrives from the catalogue or by double-click is installed disabled. | Enable it on the Mods page, after reading its permissions. |
Mods cannot be reloaded during a play |
Reload, install and uninstall wait for the end of a play. | Leave the play, then retry. |
| The same id twice | See the id messages. |
The mod failed to load
A failed mod shows its reason on the Mods page. The errors of the declaration come first, because defineMod is validated before anything runs.
| Message | Cause | Fix |
|---|---|---|
`<id>` requires modding API version 1; this game provides version 2 |
apiVersion is not the game's (it must be equal). |
Set apiVersion: 2. See apiVersion. |
`id` must be 1 to 64 characters among a-z, 0-9, `.`, `-`, `_`, starting and ending with a letter or digit (e.g. `score-counter` or `com.example.score`), got "<id>" |
The id breaks the id rules: uppercase, a space, a leading or trailing - or ., .., more than 64 characters. |
Use a lowercase id such as score-counter. |
`version` must be a semantic version such as 1.0.0, got "1.0" (…) |
version is not semver. |
Write three numbers: 1.0.0; a suffix is allowed: 1.0.0-beta.1. |
unknown field `<field>`, expected one of … |
defineMod got a field it does not declare (a typo, or a field of another contract). |
Remove it or fix its name; the message lists the valid ones. |
id: missing field (or name, version, apiVersion) |
A required field is missing. | Add it: id, name, version and apiVersion are required. |
setup must be a function |
setup is declared but is not a function. |
Give a function, or remove the field. |
`main.ts` must declare the mod with `export default defineMod({ … })` at its top level |
The file never calls defineMod at its top level (inside a function, a condition or a callback). |
Move the call to the top level: export default defineMod({ … }). |
defineMod can only be called at the top level of the mod's entry file |
defineMod was called from a function, or from a file that is not the entry file. |
Call it once, at the top level of main.ts. |
defineMod must be called exactly once |
Two calls. The first error is kept even if you catch it. | Keep one call. |
defineMod declares a mod: this skin declares itself with defineSkin |
A skin folder calls defineMod. |
Use defineSkin in skin.ts. |
another mod already uses the id `<id>`: the folder `<other>` loaded first and keeps it |
Two folders declare the same id. The game's own folder loads first, then the player's, each in folder-name order. | Rename one id. Ids are shared by mods and skins: the skin already uses the id `<id>`. |
load failed or the thrown error |
The top-level code threw. | Fix the error. At load only defineMod, log.* and ctx.on exist. |
`hud.text` is not available while the mod loads: call it from `setup` or an event handler |
A host function (hud.*, storage.*, game.*, stage.*…) ran at the top level. |
Move the call into setup or a handler. |
setup failed: … |
setup threw. |
Fix the error; the other mods load normally. |
A mod that uses packages also meets the dependency messages:
| Message | Meaning |
|---|---|
`uses` names N packages; the limit is 16 |
Too many packages in uses. |
a package cannot use itself |
A mod lists its own id. |
dependency cycle: a → b → a |
Packages depend on each other; every package of the cycle is refused. |
package <p> is not active |
The package you use is missing, failed or disabled. |
package <p> 2.0.0 does not match ^1 |
The package is there but its version is outside the range you asked for. |
feature "<name>" disabled: package <p> missing |
An optional dependency is absent: only that feature is off. |
unknown option `<x>`, expected one of … |
You configure an element option the package does not provide. |
The apiVersion surprise
apiVersion: 1 type-checks. In modding.d.ts the field is a plain number, so TypeScript cannot know the game's version. The game compares it for equality and refuses the script when it differs. The same goes for a skin and for a map script (the map script requires modding API version <n>; this game provides version 2). See Versions and changes.
The mod was disabled
| Message on the Mods page | Cause | Fix |
|---|---|---|
exceeded the 30ms execution budget <n> times |
The script spent more than 30 ms in a handler three times (the count is cumulative). | Do less per event: precompute in setup, do not loop over big arrays on every tick. See budget. |
failed 3 times in a row; last error: … |
A handler threw three times without a success in between. | Read the last error and fix it, or catch it. |
interrupted after exceeding the 30ms execution budget (…) |
A single call hit the budget and was stopped. It is also what each of the three timeouts reports. | As above. |
A disabled mod loses its HUD, judgement sets, scroll systems and ratings, and its storage is written once. A mod stays off until the host restarts (Reload or restarting the game). A skin or a map script stays off until the next map launch.
Execution budget
Each script gets 30 ms per load, setup, event handler or tick, 16 MiB of memory and a 1 MiB stack. These are real-time limits: a slow machine hits them sooner. Time is counted per call, not per frame, but a game.tick handler runs 30 times a second. Keep handlers small, do the heavy work once in setup, and read at most what you need (game.notes({ limit })). The full list is in Limits.
HUD, stage and storage limits
| Message | Cause | Fix |
|---|---|---|
the HUD node limit is 384 per mod |
You created a 385th node. | Reuse nodes (update the same id), remove the ones you no longer show, or group. |
node id must have 1 to 64 characters, without control characters |
A bad HUD node id. | Shorten it. |
node `<id>` already exists under another parent; remove it to move it |
You re-created a node under a different parent. | Remove it first, or keep its parent. |
groups nest at most 8 levels deep |
Groups are too deep. | Flatten. |
storage keys must have 1 to 128 characters |
An empty or very long storage key. | Use short keys. |
the storage holds at most 256 keys |
A 257th key. | Store one object under one key. |
the storage holds at most 262144 bytes; this value would bring it to <n> |
The mod's 256 KiB of storage is full. | Store less; delete old keys. |
storage <path>: … |
The mod's storage file is corrupt or too big, so setup fails. |
Delete mod-storage/<id>.json in the data folder, or fix it. |
popup title, detail, progress or actions exceed their bounds |
ui.popup called with too much. |
Title 1 to 96 characters, detail up to 512, up to 4 actions, done at most total. |
at most eight mod popups may be open |
Too many popups open at once. | Close some before opening more. |
invalid or duplicate popup action |
An action id is empty, longer than 32, reserved (dismiss), repeated, or has characters other than a-z 0-9 _. |
Fix the ids. |
limit must be in [1, 256], got <n> |
game.notes or game.hits asked for a limit out of range. |
Ask for 1 to 256. |
Permissions
A mod must declare what it uses in permissions, and the player can take stage and network away mod by mod. skinImport is removed by disabling the mod.
| Message | Cause | Fix |
|---|---|---|
`<function>` needs the `stage` permission: declare `permissions: ["stage"]` |
You called stage.* without declaring it. |
Add permissions: ["stage"]. |
`<function>`: the player turned off native drawing for `<id>` |
The player took the permission away on the Mods page. | Nothing to fix in the code: handle the refusal, and tell the player what the mod needs. |
`skinImport` needs the `skinImport` permission: declare `permissions: ["skinImport"]` |
skinImport.* without the permission. |
Declare it. |
`<function>` needs the `network` permission: declare `permissions: ["network"]` |
downloads.register without the permission. |
Declare it. |
Skins and map scripts
| Message | Cause | Fix |
|---|---|---|
`skin.ts` must declare the skin with `export default defineSkin({ … })` at its top level |
The skin's entry file has no top-level defineSkin. |
Add it. A skin's entry file is skin.ts. |
the map script must declare itself with `export default defineChart({ … })` at its top level |
The map script has no top-level defineChart. |
Add it. |
defineChart must be called exactly once |
Two calls. | Keep one. |
`<function>` is not available to map scripts: they only change the playfield |
A map script called hud.* or storage.*. |
A map script changes the playfield only: use playfield.*. |
`<function>` is only available to skins and map scripts |
A mod called playfield.*. |
Do that in a skin or a map script. |
the playfield only changes while a chart plays: call it from a handler between `game.songStart` and `game.songEnd` |
playfield.* called in setup or outside a play. |
Call it from a handler during a play. |
`<function>` is not available while the skin loads: call it from `setup` or an event handler |
A host function at the top level of a skin. | Move it to setup. |
declare the package before configuring elements |
ctx.element(…).configure in a map script: it has no uses, so it cannot configure elements. |
Configure elements from a skin or a mod. |
A map script lives next to its chart: script.ts for every difficulty of the folder, or <chart file name>.script.ts for one difficulty, 1 MiB at most. It is read again at every launch of the map. The player can turn all map scripts off (Settings → Gameplay → Allow map scripts, on by default). A map script that fails never stops the map: it plays with the skin alone. A skin's setup and the wait for chart.transform are capped at 1000 ms: past that the map plays unchanged ("…: the map plays unchanged").
For a chart.transform mod:
| Message | Cause |
|---|---|
chart.getNotes is only available inside a `chart.transform` handler (same for setNotes) |
The call is outside the transform handler. |
chart.setNotes refused the buffer: … |
The notes you returned break a rule: more than 100 000 notes, a column at or above the key count, a time outside the map, a hold ending before it starts, two notes starting together in a column. |
TypeScript passes but the game refuses
The SDK describes shapes. The game checks values and moments, and that is where a script that compiles can still be refused:
apiVersionis anumber:1compiles and is refused (above).- Ids, names and texts are
string: the id rules, the 1 to 32 or 64 character bounds and the closed lists (icons, groups) are checked at runtime. - Numbers are
number: ranges (layout.xbetween ±10, asizein (0, 1], 2 to 8 gradient stops) are checked at runtime. - Phases:
hud.text(…)type-checks at the top level and throws there. - Limits: 384 nodes, 256 storage keys, 30 ms per call: nothing in the types.
- Closed sets: the game declares
mirror,noLnandrankedFullLninGameplayModifierKind, yetgameplay.registerrefuses them ("Mirror is built into Prism: a mod cannot declare it"). - Unknown fields: TypeScript (excess property check) usually catches them, but a spread or an
ascast hides them from it, and the game refusesunknown field `<field>`. - Dynamic
import()is not supported: use a staticimport. Dateand the rest of plain JavaScript are available, so a script is not deterministic. Onlychart.getNotes().seedis seeded.
Run tsc --strict against modding.d.ts as a first filter, then try the mod in the game: the Mods page is the second check.
Package import errors
A .pvmod or a skin .zip is checked entirely before it is written. A failed install leaves your folders as they were. The error comes with a prefix: invalid mod package: …, invalid skin package: …, or the mod does not load: … when the declaration inside is invalid.
| Message | Cause | Fix |
|---|---|---|
not a ZIP archive (…) |
The file is not a ZIP (renamed, truncated). | Export it again. |
the package weighs <n> bytes; the limit is <m> |
Over 64 MiB. | Remove what you do not need. |
the package has <n> entries; the limit is <m> |
More than 1024 entries. | Remove files and folders. |
the package holds more than 256 files (mod) / 512 files (skin) |
Too many files. | Remove files. |
"<path>" weighs <n> bytes; the limit is <m> |
One file is over 16 MiB (mod) or 32 MiB (skin). | Compress it or drop it. |
the files weigh more than <n> bytes |
More than 64 MiB unpacked. | Remove files. |
"<path>" cannot be in a package: allowed files are .ts, .ttf, … |
A forbidden file type (.psd, .mp3 in a mod). |
Remove it. A skin may carry sounds for the game; the catalogue may not. |
"<path>" is a symbolic link / is encrypted / appears twice |
A link, an encrypted entry, or two names that differ only by case. | Remove the link, repackage without a password, rename. |
unsafe entry: … |
An absolute path, .., a drive letter or a backslash. |
Repackage from the folder itself. |
no main.ts or index.ts at the root of the package (skin: no skin.ts …) |
The entry file is missing, or sits in a folder that is not the only top folder. | Put it at the root. |
the game's own folder <dir> already holds the mod `<id>`; uninstall or edit it instead |
A mod of the same id is shipped with the game. | Pick another id. |
the folder <dir> holds another mod (`<id>`); rename it first |
An <id> folder is already used by another mod. |
Rename it. |
no installed mod has the id `<id>` |
Uninstall or export of something not installed. | Reload the Mods page. |
The rules and the formats are in .pvmod and skin package. For what the catalogue refuses on top of that, see Submit and Catalogue API.
Online and update symptoms
| Symptom | Cause | Fix |
|---|---|---|
HTTP 429 with rate_limited |
You went over a bucket's 240 per minute (catalogue 120, accounts 60). | Wait Retry-After seconds; use ETag. See rate limits. |
HTTP 401 with invalid_token |
The access token (600 s) expired or is missing. | Refresh it with the refresh token, then retry once. |
HTTP 400 with bad_request |
A malformed hash or parameter; description names it. |
Fix the parameter. |
| Catalogue item shows no description in the game | The server sends descriptionEn; the game reads description. |
See the warning in Catalogue API. |
| "Updates unavailable" | The release list could not be read. | Retry later. See Game updates. |
| An update is refused with a signature message | The .minisig is absent, invalid, or names another release. |
Nothing on the player's side: the release must be re-published. |
| "The install folder is not writable" | Prism sits in a folder the player cannot modify. | Move it to a user folder (not Program Files). |