---
title: "ThemeError"
description: "The error [createTheme](https://pitlane.tools/package/theme/function/createTheme.md) throws for every structural failure: one problem, one sentence."
url: "https://pitlane.tools/package/theme/class/ThemeError"
---

# ThemeError

```ts
import { ThemeError } from "@pitlane/theme";
```

The error [createTheme](https://pitlane.tools/package/theme/function/createTheme.md) throws for every structural failure: one problem, one sentence.

| Failure | Message shape |
| --- | --- |
| No schema entry | `"space.md" has no schema entry` |
| Unknown reference | `"color.bg" references unknown token "color.nope"` |
| Reference type mismatch | `"color.bg" references "space.md" of type "dimension" where "color" is required` |
| Reference to an untyped token | `"color.bg" references untyped token "animate.spin"` |
| Reference cycle | `Reference cycle: color.a → color.b → color.a` |
| Variable collision | `Tokens "a.b" and "a-b" both produce the CSS variable --a-b` |
| Reserved characters | `Token or group name "a.b" contains characters reserved by references (".", "{", "}")` |
| Empty identifier | `Token path segment "!!" produces an empty CSS identifier` |
| Unknown mode token | `Mode "dark" overrides unknown token "color.nope"` |

Bad token _values_ raise `ValidationError` from `remix/data-schema` instead, because there may be several and each carries its own path.

## See

[createTheme](https://pitlane.tools/package/theme/function/createTheme.md)

## Extends

- `Error`

## Constructors

### Constructor

```ts
new ThemeError(message?): ThemeError;
```

#### Parameters

##### message?

`string`

#### Returns

`ThemeError`

#### Inherited from

```ts
Error.constructor
```

### Constructor

```ts
new ThemeError(message?, options?): ThemeError;
```

#### Parameters

##### message?

`string`

##### options?

`ErrorOptions`

#### Returns

`ThemeError`

#### Inherited from

```ts
Error.constructor
```

## Properties

### cause?

```ts
optional cause?: unknown;
```

#### Inherited from

```ts
Error.cause
```

---

### message

```ts
message: string;
```

#### Inherited from

```ts
Error.message
```

---

### name

```ts
name: string = "ThemeError";
```

#### Overrides

```ts
Error.name
```

---

### stack?

```ts
optional stack?: string;
```

#### Inherited from

```ts
Error.stack
```

## Methods

### isError()

```ts
static isError(error): error is Error;
```

Indicates whether the argument provided is a built-in Error instance or not.

#### Parameters

##### error

`unknown`

#### Returns

`error is Error`

#### Inherited from

```ts
Error.isError
```
