# historyError
Source: https://docs.maelstrom-ai.co/0.2/reference/engine/variables/historyerror/
Documentation revision: 89a8f5e9d10cedcf0b30376d7846113f06f26120
SDK manifests in this build: @maelstrom-co/react@0.2.1, @maelstrom-co/client@0.2.1, @maelstrom-co/connectors@0.2.1, @maelstrom-co/protocol@0.2.1, @maelstrom-co/engine@0.2.1
These docs follow this source revision. Manifest versions do not prove release compatibility; verify the installed package exports before using an API.

> `const` **historyError**: `object`

Defined in: packages/engine/src/lib/errors.ts:276

Per-operation factories for [HistoryError](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/). Each constructor pins its `operation` literal at the type level, so an in-package call site can no longer tag (for example) a `record_turn` failure as `add_assistant_message` by passing the wrong string.

Prefer these over hand-constructing the discriminated union directly. The type itself remains structurally exported for consumers’ pattern-matching; the constructor-only guarantee applies to in-package construction only.

## Type Declaration

### addAssistantMessage

> `readonly` **addAssistantMessage**: (`message`, `cause`) => [`HistoryError`](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/)

#### Parameters

##### message

`string`

##### cause

`unknown`

#### Returns

[`HistoryError`](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/)

### clear

> `readonly` **clear**: (`message`, `cause`) => [`HistoryError`](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/)

#### Parameters

##### message

`string`

##### cause

`unknown`

#### Returns

[`HistoryError`](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/)

### getHistory

> `readonly` **getHistory**: (`message`, `cause`) => [`HistoryError`](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/)

#### Parameters

##### message

`string`

##### cause

`unknown`

#### Returns

[`HistoryError`](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/)

### getLLMContext

> `readonly` **getLLMContext**: (`message`, `cause`) => [`HistoryError`](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/)

#### Parameters

##### message

`string`

##### cause

`unknown`

#### Returns

[`HistoryError`](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/)

### leaderPipeline

> `readonly` **leaderPipeline**: (`message`, `cause`) => [`HistoryError`](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/)

#### Parameters

##### message

`string`

##### cause

`unknown`

#### Returns

[`HistoryError`](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/)

### recordTurn

> `readonly` **recordTurn**: (`message`, `cause`) => [`HistoryError`](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/)

#### Parameters

##### message

`string`

##### cause

`unknown`

#### Returns

[`HistoryError`](https://docs.maelstrom-ai.co/0.2/reference/engine/interfaces/historyerror/)
