# Build, dev server and runtime errors

The messages of a [site build](/docs/sites/static-sites), of the [dev server](/docs/sites/dev-server) and of an app while it runs, in the browser or during
static rendering. The ones of the Lithe compiler are in [Compile errors and warnings](/docs/reference/errors). In the messages below, words like `path`, `name`
or `dir` stand for what the code holds.


## Site build

| Message | Cause |
|---------|-------|
| `dir` has no module.yaml | The module directory is wrong. |
| `path` is missing, it is the page the app is rendered into | There is no `resources/index.html`. |
| `path` needs a `{{lithe.app}}` placeholder and a `</head>` tag | The template misses one. |
| `path` is missing, it is the root component of the page | There is no `src/App.lithe`. |
| Static rendering failed: | The app threw while rendering, the stack trace follows. |
| Cannot resolve the dependencies of `app`: | The toolchain failed, its output follows. |
| No `extension` of `app` found in `cache`, pass --toolchain-cache | The toolchain cache is elsewhere. |
| Compose compiler plugin not found: `jar`. Build `app` once with the toolchain so it downloads the plugin. | A module [uses Compose](/docs/sites/compose) and was never built. |
| Serialization compiler plugin not found: `jar`. Build `app` once with the toolchain so it downloads the plugin. | A module that enables `serialization` was never built. |
| The prop `name` of `Component` holds a function or markup with parameters, which a server component can't give to the browser: the component that gives it has to run in the browser too (it needs a state or an event), or give plain data. | A component rendered at build time hands a function to an [island](/docs/sites/islands), through a variable that the compiler can't see is one. |
| The page holds the island `name`, which the client doesn't know. | The page was written by another build than the client it loads. |
| The props of an island can't be of a sealed or open class: `Class`. | A prop of an island has a type that needs a class discriminator to be read. |
| Unresolved reference 'serializer' (in the `.lithe` file of the island, with source maps) | The class or enum of a prop of an island isn't `@Serializable`, or its module doesn't enable the serialization plugin. |
| Downloading `url` failed with status `code` | esbuild can't be downloaded. |
| `url` doesn't match the checksum of esbuild `version` | The download is corrupt or tampered with. |
| No `file` in the archive | The esbuild package doesn't hold the binary. |
| esbuild `version` isn't pinned for the architecture `name` | The machine has an unsupported processor. |
| The linked module has polyfills the build doesn't know: `names` | The link holds a polyfill the build doesn't know, and a needed one is never dropped silently. |

## Dev server

| Message | Cause |
|---------|-------|
| Unknown option: `option` | See [the options](/docs/sites/dev-server#options). |
| Missing value for `option` | The option is last, or followed by another option. |
| `option` given more than once | Only `--root` and `--watch` repeat. |
| `option` must be a number from 0 to `max`, got `value` | `--port` or `--debounce` is out of range. |
| No kotlin wrapper in `dir`, pass --project | The command runs outside a project. |
| Pass --module or --root | There is nothing to serve. |
| Cannot watch `dir`, not a directory | A watched path doesn't exist. |
| Build succeeded but `dir` does not exist, pass --root | The served directory isn't the one the build writes. |

## Runtime

Exceptions of the app while it runs, in the browser or during static rendering.

| Message | Cause |
|---------|-------|
| An effect keeps changing the state it reads. | An [effect](/docs/components/state#effects) writes what it follows, and never settles. |
| `onDispose`, event listeners and page values only work in `mount`, `effect`, `@mount` or the body of a component. | One is called from an event handler or other code. |
| Two items of a `@for` have the same key. | The `key` of a loop isn't unique. |
| `name` isn't an element name. | A [dynamic tag](/docs/components/markup#dynamic-tags) gets an invalid name, or an element read as text like `script` or `style`. |
| `name` isn't an attribute name. | A spread holds an invalid name, found during static rendering. |
| The content of `<tag>` can't contain its own end tag. | A `<script>` or `<style>` value holds `</script>` or `</style>`. |
| `<head>` takes elements, not `StaticHtml`, which has no key. | Hand-written Kotlin calls it inside `Head`. |
| `<head>` takes no `Key`, its elements follow the state on their own. | Hand-written Kotlin calls it inside `Head`. |
| `<head>` takes no `Await`, put the `<head>` in a component inside it. | Hand-written Kotlin calls it inside `Head`. |
| `Head` can't be inside another one. | A component with a `<head>` renders inside another `<head>`. |
