glean/error
Types
pub type FinishReason {
Stop
Length
ContentFilter
ToolCalls
FinishError
Other(String)
}
Constructors
-
StopThe model finished its answer.
-
LengthThe answer was cut off at the output token limit.
-
ContentFilterA safety filter stopped the answer, or the model refused.
-
ToolCallsThe model asked for tools.
-
FinishErrorThe provider said the generation failed part way: OpenRouter’s
errorfinish reason, Gemini’sMALFORMED_FUNCTION_CALL. -
Other(String)
pub type GleanError {
ProviderError(
provider: String,
model: String,
status: Int,
message: String,
)
ToolNotFound(tool_name: String)
ToolExecutionError(
tool_name: String,
tool_call_id: String,
reason: String,
)
ToolInputValidationError(
tool_name: String,
tool_call_id: String,
errors: List(ValidationError),
)
OutputValidationError(
errors: List(ValidationError),
text: String,
finish_reason: FinishReason,
messages: List(message.Message),
usage: usage.Usage,
)
MaxStepsExceeded(
max_steps: Int,
steps_taken: Int,
messages: List(message.Message),
usage: usage.Usage,
)
JsonParseError(input: String, message: String)
Timeout(after_ms: Int)
ConfigError(message: String)
}
Constructors
-
ProviderError( provider: String, model: String, status: Int, message: String, )Provider returned a non-200 status or network failure
-
ToolNotFound(tool_name: String)Tool call referenced a tool name not in the toolset
-
ToolExecutionError( tool_name: String, tool_call_id: String, reason: String, )Tool execution returned an error
-
ToolInputValidationError( tool_name: String, tool_call_id: String, errors: List(ValidationError), )Tool input failed schema validation
-
OutputValidationError( errors: List(ValidationError), text: String, finish_reason: FinishReason, messages: List(message.Message), usage: usage.Usage, )The final answer is not the JSON the agent’s schema asks for, and the retries allowed by
agent.output_retriesare used up.textis the answer that failed,messagesthe conversation up to and including it, andusagewhat the run cost. Whenfinish_reasonisLengththe answer was cut off at the output token limit, so it is not retried: raisemax_output_tokensinstead. -
MaxStepsExceeded( max_steps: Int, steps_taken: Int, messages: List(message.Message), usage: usage.Usage, )Max steps exceeded in the agent loop The conversation so far, including every tool call and result, so it can be inspected or resumed with
run.generate_messages, and the tokens the steps used. -
JsonParseError(input: String, message: String)JSON parsing failed
-
Timeout(after_ms: Int)Request timed out
-
ConfigError(message: String)Configuration error at agent build time
pub type ValidationError {
ValidationError(path: List(String), message: String)
}
Constructors
-
ValidationError(path: List(String), message: String)
Values
pub fn to_string(error: GleanError) -> String
Convert a GleanError to a human-readable string.
pub fn validation_errors_to_string(
errors: List(ValidationError),
) -> String
Every violation, as its path and what is wrong there, joined with ; .