#[non_exhaustive]pub enum Error {
Show 18 variants
Request(String),
UnansweredToolCalls(Vec<ToolCallId>),
PendingInterrupts(Vec<String>),
Snapshot(String),
Merge(String),
Json(Error),
Core(Error),
Decode(String),
Protocol(String),
Unsupported(String),
Patch {
target: String,
message: String,
},
InvalidPatchDocument {
target: String,
message: String,
},
State(Error),
Run {
message: String,
code: Option<String>,
},
Http {
status: u16,
body: String,
},
UnexpectedContentType(String),
Transport(Box<dyn Error + Send + Sync>),
Config(String),
}client only.Expand description
Everything that can go wrong while consuming an AG-UI stream.
The variant list is #[non_exhaustive]: new transports and validation rules
are expected to add variants without a breaking release.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Request(String)
A local request failed before dispatch.
UnansweredToolCalls(Vec<ToolCallId>)
A run was refused before dispatch because these tool calls have no answer in the transcript, in call order.
Answer each with a tool message, or give it up with
Thread::abandon_tool_call.
PendingInterrupts(Vec<String>)
A run that answers no interrupt was refused before dispatch because the thread is paused on the interrupts with these ids.
Answer them with Thread::resume,
decline or
resume_many.
Snapshot(String)
A saved local conversation is invalid or unsupported.
Merge(String)
Thread::merge_messages_from
refused to merge two threads, and changed neither: they are different
conversations, one of them still owes an answer or has a request in
flight, a tool call has a result on each, or the receiving thread gave
up a call the other holds a result for.
Json(Error)
A frame’s payload was not valid JSON, or not a valid Event.
Core(Error)
An error raised by the core protocol types.
Core’s protocol violations do not arrive here: they are flattened into
Error::Protocol so that every rule a stream can break has one shape.
Decode(String)
The bytes were not well-formed text/event-stream.
Protocol(String)
The stream parsed, but broke a rule the protocol requires — a content event with no open message, a chunk with no id to attach to, events after the run finished.
Unsupported(String)
An Applier was handed a *_CHUNK or
THINKING_* event, which it applies only in their explicit form.
Patch
An RFC 6902 patch could not be applied.
The client applies patches to a copy and commits the new document only after every operation succeeds.
Fields
InvalidPatchDocument
A patch document is structurally invalid, before application is attempted.
A malformed JSON Pointer is a producer protocol error; unlike a valid operation targeting missing state, it cannot be retried against another state value.
Fields
State(Error)
The application state did not deserialize into the caller’s type.
The raw JSON state is still updated and correct; only the typed view is unavailable.
Run
The agent reported RUN_ERROR.
Fields
Http
The server answered with a status outside 2xx.
Fields
UnexpectedContentType(String)
A successful HTTP response chose a format this transport cannot decode.
Transport(Box<dyn Error + Send + Sync>)
The transport failed — a connection reset, a DNS failure, a closed channel. Carries the underlying error.
Config(String)
A transport was configured with something it cannot use: an unparseable URL, an invalid header name.
Implementations§
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()