stalwartlabs/stalwart · critical · ScimError

Internal Server Error

Error message

Internal Server Error

What it means

A SCIM Error with HTTP status 500 ("Internal Server Error"), built by `Error::internal_error()`. The library uses it to represent unexpected server-side failures while processing a SCIM request — the fault is in the server, not the client request.

Source

Thrown at crates/scim-proto/src/message/error.rs:195

    pub fn precondition_failed() -> Self {
        Error::new(412)
    }

    pub fn max_operations_exceeded(max_operations: usize) -> Self {
        Error::new(413).with_detail(format!(
            "The number of operations in the bulk request exceeds the maxOperations ({max_operations})."
        ))
    }

    pub fn max_payload_size_exceeded(max_payload_size: usize) -> Self {
        Error::new(413).with_detail(format!(
            "The size of the bulk operation exceeds the maxPayloadSize ({max_payload_size})."
        ))
    }

    pub fn internal_error() -> Self {
        Error::new(500)
    }

    pub fn not_implemented() -> Self {
        Error::new(501)
    }

    pub fn is_client_error(&self) -> bool {
        (400..500).contains(&self.status)
    }
}

impl Serialize for Error {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        let mut map = serializer.serialize_map(None)?;
        map.serialize_entry("schemas", &[MESSAGE_ERROR])?;

View on GitHub (pinned to e962003857)

Solutions

  1. Inspect the SCIM server logs for the corresponding request/trace to find the underlying failure.
  2. Retry the request after confirming the server is healthy (500s may be transient during restarts or DB blips).
  3. If reproducible, report/fix the server-side bug; the client request is usually not at fault.

Example fix

// before
loop { client.get_user(id).await?; }
// after
match client.get_user(id).await {
    Err(e) if e.status() == 500 => backoff_retry(|| client.get_user(id)).await?,
    other => other?,
}
Defensive patterns

Strategy: retry

Try / catch

match client.get_user(id).await {
    Err(e) if e.status() == 500 => backoff::retry(3, || client.get_user(id)).await?,
    other => other?,
}

Prevention

When it happens

Trigger: A server-side handler catches an unexpected condition (storage failure, panic recovered, malformed internal state) and responds by constructing `Error::internal_error()`.

Common situations: Backend database outages, unhandled panics in request handlers, misconfigured storage backends, or bugs introduced by a server version upgrade.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of stalwartlabs/stalwart@e962003857 (2026-09-06). Data as JSON: /api/errors/834f3114051d3d75. Report an issue: GitHub.