# Validation codes

> Every problem the manifest's validator reports, by its stable code, from the SDK itself.

Page: https://songstress.app/docs/develop/validation/

One validator checks a manifest everywhere: `songstress check`, a server installing, a listing being submitted. It
works in four stages, and a stage runs only when the ones before found nothing:

1. **Reader:** the size, the depth, that the text is UTF-8 JSON, and that no object names a key twice.
2. **Schema:** the shape the JSON Schema describes.
3. **Rules:** what a schema can't say. The `install` profile ends here.
4. **Listing:** what the official list and the Marketplace ask on top, for the `listing` profile only.

Each problem has a stable code, a [JSON Pointer](https://www.rfc-editor.org/rfc/rfc6901) to where it is, and a
sentence. The code and the pointer are the contract, the same for every implementation; the sentence is for people
and may be reworded. A server also knows where a manifest came from, which the validator isn't told: from a GitHub
link or a file it refuses the publisher `songstress` with `ID_RESERVED`.

## Every code [#every-code]

Read from the SDK's own list, `MANIFEST_ERROR_CODES` in `songstress/manifest`:

| Code | Stage | What it means |
|---|---|---|
| `MANIFEST_TOO_LARGE` | Reader | The manifest is larger than 256 KiB. |
| `MANIFEST_TOO_DEEP` | Reader | The manifest nests objects and lists more than 16 levels deep. |
| `JSON_INVALID` | Reader | The text is not UTF-8 JSON, or holds a number too large to read or a damaged character. |
| `JSON_DUPLICATE_KEY` | Reader | An object names the same key twice. The pointer names the key. |
| `THEME_FILE_TOO_LARGE` | Reader | A theme file is larger than 16 KiB. |
| `SCHEMA_TYPE` | Schema | A value is of the wrong type (keyword: type). |
| `SCHEMA_REQUIRED` | Schema | A required field is missing (keyword: required). The pointer names the missing field. |
| `SCHEMA_UNKNOWN_PROPERTY` | Schema | A field the manifest does not know (keyword: additionalProperties). The pointer names the field. |
| `SCHEMA_ENUM` | Schema | A value is not one of the allowed ones (keyword: enum). |
| `SCHEMA_CONST` | Schema | A value is not the one value allowed (keyword: const). |
| `SCHEMA_PATTERN` | Schema | Text is not in the form asked (keyword: pattern). |
| `SCHEMA_LENGTH` | Schema | Text is too short or too long (keywords: minLength, maxLength). |
| `SCHEMA_RANGE` | Schema | A number is too small or too large (keywords: minimum, maximum, exclusiveMinimum). |
| `SCHEMA_ITEM_COUNT` | Schema | A list has too few or too many items (keywords: minItems, maxItems). |
| `SCHEMA_DUPLICATE_ITEM` | Schema | A list names the same item twice (keyword: uniqueItems). The pointer names the list. |
| `SCHEMA_PROPERTY_COUNT` | Schema | An object has too few fields (keyword: minProperties). |
| `TEXT_UNSAFE` | Rules | Text holds a control, invisible or direction-changing character. |
| `ID_RESERVED` | Rules | The id's publisher is a name Songstress keeps for its own API. |
| `VERSION_INVALID` | Rules | version is not a semantic version. |
| `ENGINE_RANGE_INVALID` | Rules | engines.songstress is not a range the specification allows. |
| `ENGINE_UNSUPPORTED` | Rules | engines.songstress leaves out the extension API of the host that is checking. |
| `PATH_OUTSIDE_PACKAGE` | Rules | A file path is not a plain path inside the package. |
| `BANNER_NOT_16_9` | Rules | The banner's declared size is not 16:9. |
| `ENTRY_REQUIRED` | Rules | Something needs code in an entry the manifest does not declare. |
| `ENTRY_UNUSED` | Rules | An entry is declared but nothing in the manifest would ever start it. |
| `PERMISSION_REQUIRED` | Rules | Something needs a permission the manifest does not ask for. |
| `PERMISSION_UNUSED` | Rules | A permission is asked for that nothing in the manifest can use. |
| `NETWORK_LOCAL_NOT_PRIVATE` | Rules | A network.local target is an address outside the private and loopback ranges. |
| `DUPLICATE_ID` | Rules | Two contributions of one kind share an id or a key, or a menu names one command twice. The pointer names the later one. |
| `MENU_COMMAND_UNKNOWN` | Rules | A menu item names a command the manifest does not declare. |
| `ROUTE_DUPLICATE` | Rules | Two routes answer the same method and path. The pointer names the later one. |
| `LINK_PATTERN_TOO_BROAD` | Rules | A link pattern would claim every web link. |
| `PROVIDER_PLAY_NEEDS_SEARCH` | Rules | A play provider has no search provider of the same id whose results it could play. |
| `PROVIDER_MISMATCH` | Rules | One source is given two names or two groups under different kinds. The pointer names the later one. |
| `SETTING_DEFAULT_INVALID` | Rules | A setting's default is not a value the setting itself would accept. |
| `SETTING_RANGE_INVALID` | Rules | A number setting's minimum is above its maximum. |
| `SETTING_OPTION_DUPLICATE` | Rules | Two options of a select setting share a value. The pointer names the later one. |
| `THEME_LOOKS` | Rules | A theme's looks are not the ones its appearance names, or are written both in the manifest and in its file. |
| `THEME_COLOR` | Rules | A theme's colour is not one a theme may write, or a part of it is out of its range. |
| `THEME_COLOR_ALPHA` | Rules | A theme's colour is translucent where only border and surface.hover may be. |
| `WHEN_INVALID` | Rules | A when condition is not written in the grammar every app reads. |
| `WHEN_KEY_UNKNOWN` | Rules | A when condition names a key no app knows where it stands, or a setting it may not read. |
| `LISTING_FIELD_REQUIRED` | Listing | A field the official list requires is missing. The pointer names the field. |
| `LISTING_LICENSE` | Listing | The licence is not one the official list accepts. |
| `LISTING_REPOSITORY` | Listing | repository is not a GitHub repository address. |
| `LISTING_SCREENSHOTS` | Listing | The official list asks for three to six screenshots. |

`songstress check` also holds each theme to the rules the apps hold a look to, and reports a look that fails as
`THEME_CONTRAST` or `THEME_LUMINANCE`, with the ratio it reaches. See [Themes](/docs/develop/themes/#the-rules).
