On this page

← All documentation

Reading theme errors

How to run the checker, how to read a message, what each kind of problem removes, and a catalogue of the common errors with their fix.

A theme that fails is never silent. The game tells you which file, where in it, and why, in plain words. This page shows how to run the checker, how to read what it prints, and what each kind of problem costs you. Then it walks through fourteen real mistakes, each from a folder you can open and check yourself.

Run the checker

The checker is the game's own loading code, run on a folder, with no game window:

cargo run -p modding --example check_theme -- path/to/themes

The argument is a folder that holds theme folders (<data>/themes, or a working copy), not a theme folder itself. With no argument it checks the game's own themes in content/themes. It runs the same steps as the game: the manifest, tokens.css, theme.css, then theme.ts on the script engine under its budgets, and the tree it returns validated against the contracts.

<folder>: <n> theme(s) loaded (theme API <version>)
  <id>  <n> template(s), <n> byte(s) of theme.css
  problem: "<id>": <file>: <where>: <reason>

It prints one line for each theme that loaded, then one problem: line for each problem, and exits with code 1 if there is any problem, warnings included. A theme that failed to load is missing from the first list and appears only in a problem: line. A theme that loaded with 0 template(s) while its theme.ts has a problem has lost its templates.

Run it after every change. The invalid examples of this page live in content/examples/themes-invalid/ and can be checked the same way: check_theme -- content/examples/themes-invalid prints every message below.

Read a message

A message names the theme, then the file, then the place in that file, then the reason in full words. Read it left to right.

"<theme>": <file>: <where>: <reason>
Part What it is
"<theme>" The id of the theme, which is its folder name.
<file> theme.json, tokens.css, theme.css or theme.ts. Open that file.
<where> For the CSS files, line N. For the manifest, the field. For theme.ts, the template and the node chain (below).
<reason> What is wrong, and almost always what is allowed instead.

A problem in the manifest, tokens.css or theme.css is reported one at a time: the first problem stops the file. Fix it and run the checker again. The templates of theme.ts are different: every template is checked on its own, and one template can report several problems at once.

The anatomy of a theme.ts message

A message about a template reads in six steps. Here is one, from the case ts-unknown-output:

"ts-unknown-output": theme.ts: screen.library › box.song-select › button.back (on.press › output): "back" is not an output of screen.library (outputs: <the outputs of the screen>) [at children[0]/on.press/output]
Part In the example Meaning
Template screen.library The screen, or the contract of a component, that holds the problem.
Node chain box.song-select › button.back The nodes from the root to the one at fault. A node is its kind, a dot, and its first class (box.song-select); a slot reads slot footer; a node with no class reads as its kind alone (when, text).
Attribute (on.press › output) Which part of the node is at fault, when it is not the node itself (class[0], label › bind). It is absent when the whole node is wrong.
Reason "back" is not an output of screen.library (…) What is wrong. The list in parentheses is read from the contract, so it is always the current one.
Raw path [at children[0]/on.press/output] The same place as a path in the raw tree, for tools. You do not need it to fix the problem.

A message with no node chain is about the template as a whole (a required place that is missing, for example).

Where you see them

The same line appears in four places.

  • The checker, as above.
  • Skins, in the Interface picker: a list under the theme cards, named Theme folders that cannot be used. It holds every problem of every folder, warnings and refused templates included.
  • The game log, one line for each problem, each starting with Themes: .
  • On screen, while you play: a notice, only for a template that fails while it is being drawn (see below).

What a problem removes

Where the problem is What happens to the theme
The folder name, theme.json, tokens.css, theme.css (an error) The theme is not loaded. It is not in the Interface list. The line in the list and in the log says why.
theme.css, a warning (an infinite animation) The theme loads. The warning is listed, and the checker exits with code 1.
theme.ts, the script fails (an exception, a budget exceeded, the time limit, defineTheme never called) The theme loads with its tokens, CSS and images, without any template: the game's default templates are used.
theme.ts, one template is refused The theme loads. Only that template is removed: the default one for it takes over. The other templates stay.
A template fails while drawing The template is set aside for the rest of the session and the default one draws at once. See the next section.

The fallback at run time

A template that passes the checker can still fail while it draws, for a reason the validator cannot see. The game then sets that template aside for the whole session, draws the default one in its place, and tells the player once for each contract and session:

The template of "<contract>" in the interface "<theme>" cannot be drawn; the default one is used.

This is the translation key theme.template_failed. It is a safety net, not a way to test: a theme that triggers it has a bug to report.

The catalogue

Each entry below is a folder in content/examples/themes-invalid/<case>/. The tests check that the checker reports, for each folder, the text written in its expect.txt. The messages are shown as the game prints them. Parts between < and > are filled from the contracts and change when the contracts do.

Case File The theme is
api-too-new theme.json not loaded
api-needs-version-2 theme.ts loaded, without the template
token-unknown tokens.css not loaded
token-bad-value tokens.css not loaded
artwork-hidden tokens.css not loaded
css-element-selector theme.css not loaded
css-property-not-allowed theme.css not loaded
css-infinite-animation theme.css loaded (warning)
script-timeout theme.ts loaded without templates
ts-unknown-path theme.ts loaded, one template removed
ts-unknown-output theme.ts loaded, one template removed
ts-class-not-declared theme.ts loaded, one template removed
ts-missing-slot theme.ts loaded, one template removed
ts-required-output-unbound theme.ts loaded, one template removed
face-with-button theme.ts loaded, one template removed

The files below are invalid on purpose, so they are shown as plain text.

api-too-new

The manifest asks for a theme API that the game does not speak.

  "tokens": "tokens.css",
  "localized": {},
  "themeApi": 99
}
"api-too-new": theme.json: themeApi 99 is newer than this game speaks (theme API <n>): update the game, or use a version of the theme written for API <n>

Cause. themeApi is the version of the theme contract the theme was written for. This game speaks version <n> and refuses a newer one in one sentence, instead of failing later on a node or a property it cannot know. A value that is not a whole number from 1 is refused too, with what was found.

Fix. Write the version the game speaks, or leave the field out (it means 1). If the theme really needs the newer contract, update the game.

api-needs-version-2

The manifest declares theme API 1 ("themeApi": 1) and theme.ts templates a screen that theme API 2 added.

  "themeApi": 1,
defineTheme({ screens: { settings: settingsScreen } });
"api-needs-version-2": theme.ts: screen.settings: requires themeApi 2: the screen "screen.settings" was added in theme API 2 and this theme declares themeApi 1; set "themeApi": 2 in theme.json once the theme is written for version 2

Cause. A theme that declares an older themeApi keeps loading, but the screens, faces and "accent": "map" that a later version added are refused for it, one notice each, so a theme written for version 1 never meets a contract it was not written for. The rest of the theme (tokens, CSS, its other templates) works, and the Settings window keeps the game's own layout.

Fix. Write "themeApi": 2 in theme.json once the theme is written for version 2. For a face the notice says the face contract "catalog.card" instead of the screen; for accent it names accent "map".

token-unknown

:root {
  --pv-color-scheme: dark;
  --pv-bg: #0b1320;
  --pv-text: #eef5fb;
  --pv-acent: #2dd4bf;
}
"token-unknown": tokens.css: line 5: --pv-acent is not a theme token

Cause. A typo: the name --pv-acent is not in the contract. Only the tokens of the contract are accepted, and the file is refused at the first one that is not.

Fix. Write --pv-accent. The complete list of names is on the tokens page.

token-bad-value

:root {
  --pv-color-scheme: dark;
  --pv-bg: #0b1320;
  --pv-text: #eef5fb;
  --pv-accent: #12345;
}
"token-bad-value": tokens.css: line 5: --pv-accent: a hex colour has 3, 4, 6 or 8 digits

Cause. #12345 has five digits. Each token has a type (colour, length, font, and so on) and a value that does not fit the type of its token is refused with the rule it broke.

Fix. Write a colour of 3, 4, 6 or 8 digits, such as #123456. The type of each token and its range are on the tokens page.

artwork-hidden

:root {
  --pv-color-scheme: dark;
  --pv-bg: #0b1320;
  --pv-text: #eef5fb;
  --pv-accent: #2dd4bf;
  /* An opaque black layer over the whole picture: the map would disappear. */
  --pv-shade: linear-gradient(180deg, rgb(0 0 0 / 1), rgb(0 0 0 / 1));
}
"artwork-hidden": tokens.css: the map picture must stay visible: a --pv-shade layer covers 100% of the picture on average; at most 90%

Cause. The image of the map behind the menus is part of the game's identity. A theme may tint it (--pv-shade), dim it, blur it or recolour it (--pv-art-filter), never hide it. An opaque layer covers 100 % of it. The rules (crates/themes/src/artwork.rs): at least 20 % of the picture's light must reach the screen on average, a --pv-shade layer covers at most 90 % on average, and in --pv-art-filter brightness() stays at or above 0.25, opacity() at or above 0.4 and contrast() at or above 0.5.

Fix. Give the layer an opacity below 1 (rgb(0 0 0 / .5)), or remove the layer. When the total is too low, the message gives the share that is left: the map picture must stay visible: --pv-shade and --pv-art-filter leave <n>% of it on average; at least 20% is required (a theme may tint, dim or blur it, never hide it).

css-element-selector

/* Only the theme's own classes can be selected: `button` is an element. */
button { color: var(--pv-accent); }
"css-element-selector": theme.css: line 2: the selector "button": element selectors are not allowed: select the theme's classes

Cause. theme.css styles only the classes of the theme. A selector like button would reach into the rest of the game, so the validator refuses every element selector, *, #id, :root and body.

Fix. Give a node of theme.ts a class and select it with .name. To reach an element of the game, use a class of the theme and then its data-* mark: .name [data-part='play']. A selector must start with a class of the theme.

css-property-not-allowed

.box { isolation: isolate; }
"css-property-not-allowed": theme.css: line 1: isolation: this property is not allowed in theme.css

Cause. theme.css accepts the properties of an allow-list, with typed values. isolation is not in it.

Fix. Use a listed property. The list, and the forms each one accepts, is on the CSS allow-list page. To get the effect of isolation, a positioned box with z-index: 0 also makes a stacking context.

css-infinite-animation

@keyframes pulse { from { opacity: .4; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .glow { animation: pulse 1s ease-in-out infinite alternate; }
}
"css-infinite-animation": theme.css: warning: line 3: an infinite animation repaints the page every frame, even on an idle screen; play it a few times (a finite `animation-iteration-count`), or once per selection under `[data-entering]`

Cause. An animation that never stops repaints its region on every frame, even when nothing else moves. It was measured in the game's web view: fifteen equalizer bars and two glows cost about three processor cores on a menu left alone. The checker reports any line that has the word infinite. This one is a warning: the theme still loads, but the checker exits with code 1 until you fix it.

Fix. Play decorative motion once for each selection by hooking it to [data-entering] (give the node data: { entering: c.bind('selection.entering') }), or on :hover and :focus-visible, with a finite count. Put every moving animation inside @media (prefers-reduced-motion: no-preference), as this example does. The live bars recipe shows a moving element with no animation at all.

script-timeout

// The script runs once under a 500 ms budget: a loop that never ends is stopped.
defineTheme({ screens: {} });
while (true) {}
"script-timeout": theme.ts: interrupted

Cause. theme.ts runs once, under a budget of 500 ms, 16 MiB of memory, 128 KiB of source, 4 000 nodes built and 1 MiB of JSON (crates/modding/src/theme.rs). A loop that never ends is stopped, and the engine reports it as interrupted, followed by one or more at … lines (the stack). A script that throws gives its own message in the same place.

Fix. Remove the unbounded loop. The script only builds a tree; plain loops over small lists are enough. This error removes every template of the theme, which keeps its tokens, CSS and images.

ts-unknown-path

function libraryScreen(c: Screen): ThemeNode {
  return c.box(
    { class: ['song-select', 'pv-screen'] },
    // `map.titel` is a typo of `map.title`: a type error in the editor, a refusal in Rust.
    c.text(c.bind('map.titel'), { class: 'title' }),
    c.slot('intent'), c.slot('toolbar'), c.slot('search'), c.slot('list'), c.slot('playlistSearch'), c.slot('playlists'), c.slot('visualizer'),
    c.slot('header'), c.slot('tabs'), c.slot('panels'), c.slot('footer'),
  );
}
"ts-unknown-path": theme.ts: screen.library › box.song-select › text.title (value › bind): the path "map.titel" is not in the screen: no field "titel" in "map" (fields: <the fields of map>) [at children[0]/value/bind]

Cause. bind reads a path of the input of the screen, and map.titel is a typo of map.title. With the typed c, an editor and tsc flag it before Rust does; this example uses a cast to get past them, so you can read the message.

Fix. Use a path that the contract lists: the message names the fields found at that level. Every path of every screen and contract is on the contracts page.

ts-unknown-output

function libraryScreen(c: Screen): ThemeNode {
  return c.box(
    { class: ['song-select', 'pv-screen'] },
    // "back" is not an output of screen.library (it has drawer.toggle, random, mods.open, settings.open).
    c.button({ class: 'back', label: 'Back', on: c.on.press('back') }),
    c.slot('intent'), c.slot('toolbar'), c.slot('search'), c.slot('list'), c.slot('playlistSearch'), c.slot('playlists'), c.slot('visualizer'),
    c.slot('header'), c.slot('tabs'), c.slot('panels'), c.slot('footer'),
  );
}
"ts-unknown-output": theme.ts: screen.library › box.song-select › button.back (on.press › output): "back" is not an output of screen.library (outputs: <the outputs of the screen>) [at children[0]/on.press/output]

Cause. A button calls an output by name, and the name must be an output of that screen or contract, with its arguments in order and of the right type. back is not one.

Fix. Call an output from the list in the message, or remove the button. A component template cannot call the output of a screen.

ts-class-not-declared

function libraryScreen(c: Screen): ThemeNode {
  return c.box(
    { class: ['song-select', 'pv-screen'] },
    // `unknown` is not defined in theme.css, and the screen does not list it.
    c.box({ class: 'unknown' }, c.slot('intent')),
    c.slot('toolbar'), c.slot('search'), c.slot('list'), c.slot('playlistSearch'), c.slot('playlists'), c.slot('visualizer'),
    c.slot('header'), c.slot('tabs'), c.slot('panels'), c.slot('footer'),
  );
}
.known { padding: 4px; }
"ts-class-not-declared": theme.ts: screen.library › box.song-select › box.unknown (class[0]): the class "unknown" is neither defined by theme.css nor a class of the game here (game classes: <the classes of the screen>) [at children[0]/class[0]]

Cause. Every class is a class of the theme, defined in theme.css, or a class of the game that the screen or contract lists. unknown is neither. A class in both is refused too, as ambiguous: rename the theme's.

Fix. Write a rule for .unknown in theme.css (a class that only names a box still needs a rule), or use a listed class of the game.

ts-missing-slot

// The `footer` place (rating, judgement, Play) is missing: a theme can move Play, never remove it.
function libraryScreen(c: Screen): ThemeNode {
  return c.box(
    { class: ['song-select', 'pv-screen'] },
    c.slot('intent'), c.slot('toolbar'), c.slot('search'), c.slot('list'), c.slot('playlistSearch'), c.slot('playlists'), c.slot('visualizer'),
    c.slot('header'), c.slot('tabs'), c.slot('panels'),
  );
}
"ts-missing-slot": theme.ts: screen.library: the required slot "footer" is not placed (place it with slot("footer"); inside a `when` it counts)

Cause. A screen template must place every place the screen requires. footer holds the rating, the judgement and Play: a theme can move Play, never remove it. This message has no node chain: it is about the template as a whole.

Fix. Add c.slot('footer') somewhere in the template. A place inside a when counts. Which places are required is on the contracts page.

ts-required-output-unbound

// The footer contract requires its `confirm` output (Play) to be called by a button. This template only shows text.
defineTheme({ components: { 'library.footer': footer } });
function footer(c: Footer): ThemeNode {
  return c.row({ class: 'foot' }, c.text('Ready'));
}
"ts-required-output-unbound": theme.ts: library.footer: the required output "confirm" is not bound to any control (a button must call it)

Cause. A contract can require an output. library.footer requires confirm, which is Play, and a template that only shows text would make Play disappear.

Fix. Add a button that calls it: c.button({ label: 'Play', on: c.on.press('confirm') }). A complete footer, with the two choosers, is in the footer strip recipe.

face-with-button

// A face is the inside of a card whose own button, keyboard and menu belong to the game: it cannot hold a button.
defineTheme({ components: { 'library.setCard': setCard } });
function setCard(c: SetCard): ThemeNode {
  return c.row({ class: 'sc' }, c.text(c.bind('title')), c.button({ label: 'Open', on: c.on.press('toggle', c.bind('position')) }));
}
"face-with-button": theme.ts: library.setCard › row.sc › button: a button is not allowed in library.setCard: the host draws and owns the card's own button, keyboard, menus and actions, a theme draws what is inside it (box, row, column, text, icon, image, meter, slot, each, when) [at children[1]]

Cause. library.setCard, library.chartRow and leaderboard.card are faces: the game owns the card's button, its keyboard, its menus and its actions, and the theme draws only what is inside. A face may not hold a button, a toggle or a dropdown, a slot that mounts another contract, or an output call, so it cannot add a tab stop or an action.

Fix. Remove the button and show the text, an icon or a meter instead; the card itself is already the game's button. The slanted cards recipe is a valid face.

Other frequent messages

Parts between < and > are the variable part of the message. Messages are in English in every language of the docs.

The folder and the manifest

Message Cause and fix
the folder name must be lower-case letters, digits and hyphens (at most 32) The folder name is also the id. Rename it: no capitals, no spaces.
no theme.json The folder has no manifest.
theme.json: the id "<id>" must be the folder name id differs from the folder name.
theme.json: <what the JSON reader says> The file is not valid JSON, or a required field (id, name) is missing.
name: 1 to 48 characters Also description: 0 to 240 characters, author: 0 to 64 characters. The name is 1 to 48 characters, without control characters.
version: letters, digits and . _ + - only (at most 32) Fix the version string.
order: from 0 to 1000 order is the position in the picker.
theme.json: themeApi is the version of the theme contract the theme was written for, a whole number from 1 (this game speaks theme API <n>); found <value> themeApi is not a whole number from 1 ("1", 0, 1.5, true).
"_base" in <folder>: the base templates belong to the game's own themes folder; this folder is ignored _base is the game's default templates. Do not create it.
"<id>" in <folder>: the theme "<id>" was already found earlier in the search path and wins The same id exists twice: the first folder in the search order is used.

tokens.css

Message Cause and fix
the file has no :root block Put the declarations in :root { … }.
a second :root block (put width-dependent values in @media blocks) One :root only; narrow-window values go in @media (max-width: <n>px) (n from 320 to 4000, two blocks at most).
line <n>: only --pv-* properties are allowed, not "<name>" A plain CSS property in tokens.css. Only tokens belong there.
line <n>: --pv-<name> is declared twice Delete one of the two.
line <n>: the declaration of --pv-<name> does not end with `;` Add the semicolon.
line <n>: only a `:root { … }` rule is allowed (no other selector, at-rule or nesting) Nothing but :root and @media.
<n> declarations exceed the 200 limit The file may hold 200 declarations.
line <n>: --pv-<name>: the value exceeds 600 characters Shorten the value.
line <n>: --pv-<name>: "url(" is not allowed in a token value Also expression, @import, javascript, attr(, env(. Pictures are written image("images/x.png").
line <n>: --pv-<name>: "<value>" is not a colour Also <name>() is not a colour function.
line <n>: --pv-<name>: blur is at most 12px A filter token may blur at most 12 px.
<tokens> and <tokens>: the <label> and <label> curves of the progression graph must differ by at least 30 degrees of hue (or 0.25 of lightness for greys) Two of the three replay-graph colours are too close to tell apart. The message names the two tokens.
the map picture must stay visible: --pv-shade and --pv-art-filter leave <n>% of it on average; at least 20% is required (a theme may tint, dim or blur it, never hide it) See artwork-hidden.

theme.css

Message Cause and fix
line <n>: the selector "<selector>": a selector starts with one of the theme's classes (`.name`) The first part of a selector is a class of the theme.
line <n>: the selector "<selector>": ::<name> is not allowed (only ::before and ::after, last in a selector of a rule) A pseudo-element ends its selector, once.
line <n>: <property>: this property is not allowed in theme.css See css-property-not-allowed.
line <n>: <property>: `!important` and `!` are not allowed Raise the specificity by repeating a data-* mark instead.
line <n>: <property>: the value is empty Write a value.
line <n>: @<name> is not allowed in theme.css (only @keyframes and @media) No @import, @font-face, @supports.
line <n>: the animation "<name>" has no @keyframes in this file Define the @keyframes in the same file.
line <n>: `\` escapes are not allowed Write the character itself.
line <n>: z-index: a z-index is a whole number from -50 to 50, or auto Lower the z-index.
line <n>: url("<path>"): the theme has no such picture in images/ Only url("images/x.png"), a file of the theme.
line <n>: <name>: this token is set in tokens.css, not in theme.css (a rule may set the colours, lengths, fonts, weights, shadows, durations and easings) Layout words, pictures and the map picture's layers are set once, in tokens.css.
line <n>: <name>: a custom property is `--tpl-<name>` (lower-case letters, digits, `-`), a design token or a plate variable (<the plate variables>) A variable you define is --tpl-*.
the file exceeds 262144 bytes Also line <n>: more than 2048 rules and line <n>: more than 40 declarations in a rule.

theme.ts, the script

Message Cause and fix
theme.ts: interrupted See script-timeout.
theme.ts is <n> bytes, over the 131072 limit The source is over 128 KiB.
theme.ts never called defineTheme({ screens, components }) The file must call defineTheme once.
defineTheme() can be called once Merge the calls.
theme.ts does not compile: <details> A syntax error.
defineTheme(): component "<contract>": button(): attribute `on` is required The builder (here button) is missing an attribute. The same shape reports unknown attribute, and a wrong type with what was found. The line is followed by the stack. The whole script stopped, so the theme loses all its templates, not one.
the script built more than <n> nodes (at most <n> may stay in the theme) Also the templates have <n> nodes, over the 4000 limit. A loop built too much.

theme.ts, the templates

Message Cause and fix
there is no screen "<name>" (screens: <list>) Also there is no contract "<name>" (contracts: <list>). The key of screens or components is not in the contracts table.
the required slot "<name>" is not placed (place it with slot("<name>"); inside a `when` it counts) See ts-missing-slot.
"<name>" is not a slot of the <place> (slots: <list>) c.slot names a place the template does not have.
the required output "<name>" is not bound to any control (a button must call it) See ts-required-output-unbound.
"<name>" is not an output of <owner> (outputs: <list>) See ts-unknown-output.
<output> takes <n> arguments (<name>: <type>, …) and <m> are given The call has the wrong number of arguments.
the path "<path>" is not in the <place>: no field "<name>" in <where> (fields: <list>) See ts-unknown-path.
"<value>" is not a value of the field (values: <list>) An enumeration is compared only with its own values.
the class "<name>" is neither defined by theme.css nor a class of the game here (game classes: <list>) See ts-class-not-declared.
the class "<name>" is both a class of the game and a class of theme.css: rename the theme's Rename the class in theme.css and theme.ts.
<name>: "<part>" is not a part of <contract> (parts: <list>) part names a data-part the contract does not have. A screen has no parts.
"<image>" is not in the theme's images/ folder An image node names a picture the folder does not have.
a button has a `label` or `children` (it needs a name) A button needs a text for its accessible name.
a <kind> is not allowed in <contract>: … See face-with-button.
<n> nodes in children exceed the limit of 64 Also nodes nest deeper than 24 levels, the templates of the theme exceed the limit of 1500 nodes, a text of <n> characters exceeds the limit of 200.
"<kind>" is not a node kind (kinds: <list>) The list of kinds is on the nodes page.

When a message is not in these lists, read it the same way: file, place, reason. The reason says what is allowed. If it does not, the reference pages tokens, nodes, contracts and CSS allow-list hold the complete lists. For installing and sharing a theme, see Sharing.

Source in the game repository: crates/modding/examples/check_theme.rs,crates/themes/src/library.rs,crates/themes/src/template/validate.rs,crates/themes/src/stylesheet.rs,crates/themes/src/css.rs,crates/themes/src/grammar.rs,crates/themes/src/artwork.rs,crates/themes/src/api.rs,crates/modding/src/theme.rs,content/examples/themes-invalid/