Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

RunErrorEvent.md

128 lines2.4 KB

1---
2id: RunErrorEvent
3title: RunErrorEvent
4---
5​
6Defined in: [packages/ai/src/types.ts:1654](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1654)
7​
8Emitted when an error occurs during a run.
9​
10@ag-ui/core provides: `message`, `code?`
11Spec `usage[]` is provider/model token counts. Interrupt errors live in
12`metadata.tanstack.interruptErrors`.
13​
14## Extends
15​
16- `Pick`\<`AGUIRunErrorEvent`, `"message"` \| `"code"` \| `"timestamp"` \| `"rawEvent"`\>
17​
18## Properties
19​
20### error?
21​
22```ts
23optional error?: object;
24```
25​
26Defined in: [packages/ai/src/types.ts:1667](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1667)
27​
28Nested payload kept for in-process / durability consumers.
29​
30#### code?
31​
32```ts
33optional code?: string;
34```
35​
36#### message
37​
38```ts
39message: string;
40```
41​
42***
43​
44### metadata?
45​
46```ts
47optional metadata?: object & Record<string, any>;
48```
49​
50Defined in: [packages/ai/src/types.ts:1674](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1674)
51​
52#### Type Declaration
53​
54##### tanstack?
55​
56```ts
57optional tanstack?: TanStackRunMetadata;
58```
59​
60***
61​
62### model?
63​
64```ts
65optional model?: string;
66```
67​
68Defined in: [packages/ai/src/types.ts:1665](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1665)
69​
70Restored on the client from `metadata.tanstack`.
71​
72***
73​
74### retryAfterMs?
75​
76```ts
77optional retryAfterMs?: number;
78```
79​
80Defined in: [packages/ai/src/types.ts:1673](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1673)
81​
82How long the provider asks you to wait before a retry, in milliseconds.
83Adapters read it from the `retry-after-ms` or `retry-after` header.
84`chat()` moves it to `metadata.tanstack.retryAfterMs`.
85​
86***
87​
88### runId?
89​
90```ts
91optional runId?: string;
92```
93​
94Defined in: [packages/ai/src/types.ts:1663](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1663)
95​
96Restored on the client from `metadata.tanstack`.
97​
98***
99​
100### threadId?
101​
102```ts
103optional threadId?: string;
104```
105​
106Defined in: [packages/ai/src/types.ts:1661](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1661)
107​
108Restored on the client from `metadata.tanstack`.
109​
110***
111​
112### type
113​
114```ts
115type: RUN_ERROR;
116```
117​
118Defined in: [packages/ai/src/types.ts:1658](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1658)
119​
120***
121​
122### usage?
123​
124```ts
125optional usage?: TokenUsage<ProviderUsageDetails> | TokenUsage[];
126```
127​
128Defined in: [packages/ai/src/types.ts:1659](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1659)