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

# Error • Rust AI Agent SDK

> Error: Main error type for PraisonAI Core

# Error

> Defined in the [**error**](../modules/error) module.

<Badge color="orange">Rust AI Agent SDK</Badge>

Main error type for PraisonAI Core

## Fields

| Name      | Type      | Description          |
| --------- | --------- | -------------------- |
| `Agent`   | `variant` | -                    |
| `related` | `variant` | -                    |
| `errors`  | `variant` | -                    |
| `error`   | `variant` | Agent-related errors |
| `Agent`   | `variant` | Agent-related errors |
| `error`   | `variant` | Agent-related errors |
| `0`       | `variant` | Agent-related errors |

## Methods

### `agent`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn agent(msg: impl Into<String>) -> Self
```

Create an agent error

**Parameters:**

| Name  | Type                      |
| ----- | ------------------------- |
| `msg` | `impl Into&lt;String&gt;` |

### `tool`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn tool(msg: impl Into<String>) -> Self
```

Create a tool error

**Parameters:**

| Name  | Type                      |
| ----- | ------------------------- |
| `msg` | `impl Into&lt;String&gt;` |

### `llm`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn llm(msg: impl Into<String>) -> Self
```

Create an LLM error

**Parameters:**

| Name  | Type                      |
| ----- | ------------------------- |
| `msg` | `impl Into&lt;String&gt;` |

### `memory`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn memory(msg: impl Into<String>) -> Self
```

Create a memory error

**Parameters:**

| Name  | Type                      |
| ----- | ------------------------- |
| `msg` | `impl Into&lt;String&gt;` |

### `workflow`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn workflow(msg: impl Into<String>) -> Self
```

Create a workflow error

**Parameters:**

| Name  | Type                      |
| ----- | ------------------------- |
| `msg` | `impl Into&lt;String&gt;` |

### `config`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn config(msg: impl Into<String>) -> Self
```

Create a config error

**Parameters:**

| Name  | Type                      |
| ----- | ------------------------- |
| `msg` | `impl Into&lt;String&gt;` |

### `io`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn io(msg: impl Into<String>) -> Self
```

Create an IO error from a string message

**Parameters:**

| Name  | Type                      |
| ----- | ------------------------- |
| `msg` | `impl Into&lt;String&gt;` |

### `handoff`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn handoff(msg: impl Into<String>) -> Self
```

Create a handoff error

**Parameters:**

| Name  | Type                      |
| ----- | ------------------------- |
| `msg` | `impl Into&lt;String&gt;` |

### `with_context`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn with_context(self, context: impl Into<String>) -> Self
```

Add context to an error

**Parameters:**

| Name      | Type                      |
| --------- | ------------------------- |
| `context` | `impl Into&lt;String&gt;` |

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/error.rs">
  `praisonai/src/error.rs` at line 0
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Error Handling" icon="triangle-exclamation" href="/docs/rust/error-handling" />

  <Card title="Rust Retry" icon="rotate-right" href="/docs/rust/retry" />

  <Card title="Rust Failover" icon="shield" href="/docs/rust/failover" />
</CardGroup>
