# Error codes

The code of every error loadFile and mountFile report, what it means and what to do.

`loadFile`, `mountFile` and the `rupaerror` event of `<rupa-player>` report a `FileError`: an `Error` with a `code` and a
message that says what failed.

| Code | Meaning | What to do |
| - | - | - |
| `unsupported` | The browser or the page lacks what the player needs (`DecompressionStream`, `DOMParser`, `FontFace`, constructable stylesheets); the root is in another document than the player's (an iframe's); `integrity` was given outside a secure context; or the page's Trusted Types refused the `rupa-player` policy. | See [browser support](/reference/browser-support/). Serve the page over https when you use `integrity`, and allow `rupa-player` in `trusted-types`. |
| `network` | The file could not be fetched, or the server answered with an error status (named in the message). | Check the URL, and that another origin allows the request (CORS). |
| `size` | The download is over 25 MB, the file unpacks to over 50 MB, or its CSS holds over 20000 rules and selectors. | Export a smaller file, or see [large animations](/guides/large-animations/). |
| `integrity` | The `integrity` option is malformed (it must be `sha256-<base64>`), does not match the file's bytes, or was given with a file already parsed. | Update `integrity` after every re-export, and pass it with a URL, not a parsed file. |
| `gzip` | The bytes are not gzip, or are cut short. | The file is damaged or is not a `.rupaplay` file: export it again. |
| `json` | The bytes unpack to text that is not JSON. | Export the file again. |
| `format` | The JSON is not a `.rupaplay` file (the message names the field that fails), or its markup has no root element of its root class. | Check that `src` points to a `.rupaplay` file, and that the root element matches it. |
| `version` | The file is of a newer format, or needs a newer player. | Update `@rupamotion/player`. |
| `internal` | An unexpected error inside the player (in `error.cause`). `mountFile` left the root as it was. | Report it with `error.cause`, and see [errors](/guides/errors/). |

```js
import { mountFile } from "@rupamotion/player/file";

const { error } = await mountFile(document.querySelector("#hero"), "/hero.rupaplay");
if (error?.code === "version") console.warn("Update @rupamotion/player");
```
