janhq/jan · warning · ServerError::Tauri

Tauri error: {0}

Error message

Tauri error: {0}

What it means

`ServerError::Tauri` wraps a `tauri::Error` propagated via `#[from]`. It fires when an interaction with the Tauri runtime itself fails — emitting an event, accessing the app handle, managing a window, or invoking a Tauri command infrastructure piece. Like the Io variant, the custom `Serialize` impl converts it into an `MlxError` (with `ErrorCode::InternalError`) for transport to the JS frontend.

Source

Thrown at src-tauri/plugins/tauri-plugin-mlx/src/error.rs:65

        }

        Self::new(
            ErrorCode::MlxProcessError,
            "The MLX model process encountered an unexpected error.".into(),
            Some(stderr.into()),
        )
    }
}

#[derive(Debug, thiserror::Error)]
pub enum ServerError {
    #[error(transparent)]
    Mlx(#[from] MlxError),

    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),

    #[error("Tauri error: {0}")]
    Tauri(#[from] tauri::Error),
}

impl serde::Serialize for ServerError {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let error_to_serialize: MlxError = match self {
            ServerError::Mlx(err) => err.clone(),
            ServerError::Io(e) => MlxError::new(
                ErrorCode::IoError,
                "An input/output error occurred.".into(),
                Some(e.to_string()),
            ),
            ServerError::Tauri(e) => MlxError::new(
                ErrorCode::InternalError,
                "An internal application error occurred.".into(),

View on GitHub (pinned to fad3f12a14)

Solutions

  1. Inspect the wrapped `tauri::Error` variant for the specific failure (event, window, state, serialize).
  2. For emit-after-close failures, guard the emit with a window-liveness check or simply log-and-continue.
  3. Confirm Tauri state is registered with `.manage(...)` before the plugin reads it.
  4. Ensure all payloads crossing the Tauri boundary implement `Serialize`.

Example fix

// before
app_handle.emit("progress", &payload)?;

// after - tolerate a closed window
if let Err(e) = app_handle.emit("progress", &payload) {
    tracing::warn!("emit progress failed (window likely closed): {e}");
}
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

if let Err(e) = app_handle.emit("progress", &payload) {
    tracing::warn!("emit failed (window closed?): {e}");
    // do not abort the long-running task for a transient emit failure
}

Prevention

When it happens

Trigger: Calling `app_handle.emit(...)` and the event system fails; managing a window that has been closed; serializing a payload that does not implement `Serialize` correctly; accessing Tauri state that has not been registered.

Common situations: Emitting progress events after the frontend window has closed (the emit returns an error); a state-management misconfiguration; a serialization failure on a complex payload; version mismatch between the plugin and the Tauri runtime.

Related errors


AI-assisted analysis of janhq/jan@fad3f12a14 (2026-08-12). Data as JSON: /api/errors/db915f0eb6c4bd12. Report an issue: GitHub.