--- id: CodeModeExternalErrorEvent title: CodeModeExternalErrorEvent --- Defined in: [packages/ai/src/types.ts:2018](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2018) Custom event for extensibility. @ag-ui/core provides: `name`, `value`, `subagentRunId?` ## Extends - [`CustomEvent`](CustomEvent.md) ## Properties ### metadata? ```ts optional metadata?: Record; ``` Defined in: [packages/ai/src/types.ts:1904](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1904) Extra information attached to this event. #### Inherited from [`CustomEvent`](CustomEvent.md).[`metadata`](CustomEvent.md#metadata) *** ### name ```ts name: "code_mode:external_error"; ``` Defined in: [packages/ai/src/types.ts:2019](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2019) What this custom event is. Required: without it a consumer cannot route the value. #### Overrides ```ts CustomEvent.name ``` *** ### type ```ts type: "CUSTOM"; ``` Defined in: [packages/ai/src/types.ts:1903](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1903) #### Inherited from [`CustomEvent`](CustomEvent.md).[`type`](CustomEvent.md#type) *** ### value ```ts value: object; ``` Defined in: [packages/ai/src/types.ts:2020](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2020) The payload. Any JSON value, and required. #### duration ```ts duration: number; ``` #### error ```ts error: string; ``` #### function ```ts function: string; ``` #### Overrides ```ts CustomEvent.value ```