pub enum ApiError {
Show 32 variants
BadRequest(String),
Unauthorized,
Forbidden(String),
NotFound(String),
Conflict(String),
Validation(ValidationDetails),
LoginBadCredentials,
LoginUserNotVerified,
RegisterUserAlreadyExists,
RegisterInvalidPassword(String),
ResetPasswordBadToken,
ResetPasswordInvalidPassword(String),
VerifyUserBadToken,
VerifyUserAlreadyVerified,
UpdateUserEmailAlreadyExists,
UpdateUserInvalidPassword(String),
ApiKeyEnvelope(String),
PipelineErrored {
pipeline_source: PipelineErrorSource,
run_info: Value,
},
Teapot(String),
WriteEndpointError {
error: String,
detail: Option<String>,
status: StatusCode,
},
WriteEnvelopeError(String, StatusCode),
ErrorMessageError(String, StatusCode),
OntologyEnvelope(String, StatusCode),
DeprecatedConflict(String),
NotImplemented(String),
ServiceUnavailable(String),
NotImplementedStub {
code: &'static str,
detail: &'static str,
},
SearchError {
status: StatusCode,
error: String,
detail: Option<String>,
},
RecallError {
status: StatusCode,
body: RecallErrorBody,
},
LlmError(StatusCode, String),
VisualizeError(StatusCode, String),
Internal(Error),
}Expand description
HTTP-layer error type. Every handler returns Result<T, ApiError> and the
IntoResponse impl maps variants to the Python-compatible JSON envelopes.
Variants§
BadRequest(String)
400 {"detail": "..."} — generic bad-request condition.
401 {"detail": "Unauthorized"}.
Forbidden(String)
403 {"detail": "..."}.
NotFound(String)
404 {"detail": "..."}.
Conflict(String)
409 {"detail": "..."}.
Validation(ValidationDetails)
400 {"detail": [...], "body": ...} — serde/Pydantic-style validation.
LoginBadCredentials
400 {"detail": "LOGIN_BAD_CREDENTIALS"} — fastapi-users compat.
LoginUserNotVerified
400 {"detail": "LOGIN_USER_NOT_VERIFIED"} — fastapi-users compat.
RegisterUserAlreadyExists
400 {"detail": "REGISTER_USER_ALREADY_EXISTS"} — fastapi-users compat.
RegisterInvalidPassword(String)
400 {"detail": {"code": "REGISTER_INVALID_PASSWORD", "reason": "..."}}.
ResetPasswordBadToken
400 {"detail": "RESET_PASSWORD_BAD_TOKEN"} — fastapi-users compat.
ResetPasswordInvalidPassword(String)
400 {"detail": {"code": "RESET_PASSWORD_INVALID_PASSWORD", "reason": "..."}}.
VerifyUserBadToken
400 {"detail": "VERIFY_USER_BAD_TOKEN"} — fastapi-users compat.
VerifyUserAlreadyVerified
400 {"detail": "VERIFY_USER_ALREADY_VERIFIED"} — fastapi-users compat.
UpdateUserEmailAlreadyExists
400 {"detail": "UPDATE_USER_EMAIL_ALREADY_EXISTS"} — fastapi-users compat.
UpdateUserInvalidPassword(String)
400 {"detail": {"code": "UPDATE_USER_INVALID_PASSWORD", "reason": "..."}}.
ApiKeyEnvelope(String)
400 {"error": {"message": "..."}} — unique envelope used ONLY by the api-keys router.
Never use this variant outside routers/api_keys.rs.
PipelineErrored
420 (Improve) or 500 (all others) — pipeline job returned an error.
pipeline_source = Improve→ HTTP 420, body is the rawrun_infovalue (Python’s/improvereturns thePipelineRunInfoobject directly, not the canonical envelope).- all other sources → HTTP 500, body is
{"error": "Pipeline run errored", "detail": "<msg>"}.
/remember does not use this variant — its catch-all is
ApiError::DeprecatedConflict("An error occurred during remember.") per
Python parity (produces {"error": "..."}, not {"detail": "..."}).
/improve’s generic catch-all similarly uses ApiError::DeprecatedConflict.
Note: the field is named pipeline_source (not source) to prevent
thiserror from treating it as an error-chain source.
Fields
pipeline_source: PipelineErrorSourceTeapot(String)
418 {"detail": "<msg>"} — Python fallback for uncategorized errors.
Changed from a unit variant to carry a message string for Python parity
(datasets and add routers use this with dynamic messages).
WriteEndpointError
add/update error envelope: {"error": "...", "detail": "..."}.
Used only by routers/add.rs and routers/update.rs — the only routes
that deviate from the canonical {"detail": "..."} shape.
WriteEnvelopeError(String, StatusCode)
<status> {"error": "..."} — used by datasets 2.2 catch-all (409),
datasets 2.6 (404), and datasets 2.8 (404).
ErrorMessageError(String, StatusCode)
<status> {"message": "..."} — used by datasets 2.3 (404).
OntologyEnvelope(String, StatusCode)
<status> {"error": "..."} — used by ontologies and forget.
DeprecatedConflict(String)
409 {"error": "..."} — used by the deprecated /delete endpoint and by
the /remember and /improve catch-all error paths.
Python parity: those routers return JSONResponse({"error": "..."}) with
status 409, not HTTPException(409, detail=...), so the body key is
"error" rather than "detail". This is intentionally different from
ApiError::Conflict which uses the "detail" key.
NotImplemented(String)
501 {"detail": "..."} — not implemented (e.g. unsupported storage scheme).
503 {"error": "..."} — service unavailable.
Used by /api/v1/remember/entry when the session cache is not
configured. Mirrors Python’s
JSONResponse(status_code=503, content={"error": str(error)})
(get_remember_router.py:158-160).
NotImplementedStub
501 {"detail": "...", "code": "..."} — structured stub envelope.
Field order is wire-load-bearing: detail first, then code, matching
Python’s JSONResponse({"detail": ..., "code": ...}) insertion order.
Used by the notebooks /run stub and the responses stub.
SearchError
<status> {"error": "<error>", "detail": "<detail>"} — used by
/api/v1/search (403/422/500) and GET /api/v1/search (500).
Mirrors Python’s ErrorResponse model.
RecallError
Three-shaped envelope used only by /api/v1/recall.
WithHint { error, hint }for 422 prerequisite errors.JustError { error }for the 409 catch-all and the GET-history 500.
Permission denied is NOT encoded here — the recall handler returns
200 [] directly without going through ApiError.
LlmError(StatusCode, String)
<status> {"error": "<msg>"} — used by /api/v1/llm/* for 400/409/422.
VisualizeError(StatusCode, String)
<status> {"error": "<msg>"} — used by /api/v1/visualize/* for the
409 catch-all and the 403 superuser-only failure.
Internal(Error)
500 — unhandled internal error.
Trait Implementations§
Source§impl Error for ApiError
impl Error for ApiError
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()
Source§impl IntoResponse for ApiError
impl IntoResponse for ApiError
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Auto Trait Implementations§
impl Freeze for ApiError
impl RefUnwindSafe for ApiError
impl Send for ApiError
impl Sync for ApiError
impl Unpin for ApiError
impl UnsafeUnpin for ApiError
impl UnwindSafe for ApiError
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> AsErrorSource for Twhere
T: Error + 'static,
impl<T> AsErrorSource for Twhere
T: Error + 'static,
Source§fn as_error_source(&self) -> &(dyn Error + 'static)
fn as_error_source(&self) -> &(dyn Error + 'static)
Source§impl<T> AsErrorSource for Twhere
T: Error + 'static,
impl<T> AsErrorSource for Twhere
T: Error + 'static,
Source§fn as_error_source(&self) -> &(dyn Error + 'static)
fn as_error_source(&self) -> &(dyn Error + 'static)
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more