> ## Documentation Index
> Fetch the complete documentation index at: https://docs.moss.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# MossError

> An Error with a stable code, from the native core or the SDK.

[@moss-js/moss](../api) / MossError

# Interface: MossError

An `Error` with a stable `code`, from the native core or the SDK. A core failure carries
fixed text for each kind of failure, such as `Index not found.`, and `detail` holds the core
error text. A `MossError` the SDK raises itself describes its cause and has no `detail`.
Not every SDK error is a `MossError`: a closed client or session, `createIndex` with no
documents and the custom-embedding checks throw a plain `Error` with no `code`.
*(@moss-js/moss 1.16.0+)*

`MossError` is a type, not a class. Narrow a caught value with
[`isMossError`](../functions/isMossError) rather than `instanceof`.

## Extends

* `Error`

## Properties

| Property | Type | Description |
| - | - | - |
| `code` | [`MossErrorCode`](../type-aliases/MossErrorCode) | The kind of failure, stable across releases. Branch on it instead of the message. |
| `detail?` | `string` | The core error text, for logs and support, at most 512 bytes. Diagnostic text, not a stable contract. |

See [Error codes](/docs/reference/errors#error-codes).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.