{"record":{"id":"db915f0eb6c4bd12","repo":"janhq/jan","slug":"tauri-error-0-db915f","errorCode":null,"errorMessage":"Tauri error: {0}","messagePattern":"Tauri error: (.+?)","errorType":"exception","errorClass":"ServerError::Tauri","httpStatus":null,"severity":"warning","filePath":"src-tauri/plugins/tauri-plugin-mlx/src/error.rs","lineNumber":65,"sourceCode":"        }\n\n        Self::new(\n            ErrorCode::MlxProcessError,\n            \"The MLX model process encountered an unexpected error.\".into(),\n            Some(stderr.into()),\n        )\n    }\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum ServerError {\n    #[error(transparent)]\n    Mlx(#[from] MlxError),\n\n    #[error(\"IO error: {0}\")]\n    Io(#[from] std::io::Error),\n\n    #[error(\"Tauri error: {0}\")]\n    Tauri(#[from] tauri::Error),\n}\n\nimpl serde::Serialize for ServerError {\n    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>\n    where\n        S: serde::Serializer,\n    {\n        let error_to_serialize: MlxError = match self {\n            ServerError::Mlx(err) => err.clone(),\n            ServerError::Io(e) => MlxError::new(\n                ErrorCode::IoError,\n                \"An input/output error occurred.\".into(),\n                Some(e.to_string()),\n            ),\n            ServerError::Tauri(e) => MlxError::new(\n                ErrorCode::InternalError,\n                \"An internal application error occurred.\".into(),","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/janhq/jan/blob/fad3f12a147d138388a66f0d92a02b2675f65294/src-tauri/plugins/tauri-plugin-mlx/src/error.rs#L47-L83","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the wrapped `tauri::Error` variant for the specific failure (event, window, state, serialize).","For emit-after-close failures, guard the emit with a window-liveness check or simply log-and-continue.","Confirm Tauri state is registered with `.manage(...)` before the plugin reads it.","Ensure all payloads crossing the Tauri boundary implement `Serialize`."],"exampleFix":"// before\napp_handle.emit(\"progress\", &payload)?;\n\n// after - tolerate a closed window\nif let Err(e) = app_handle.emit(\"progress\", &payload) {\n    tracing::warn!(\"emit progress failed (window likely closed): {e}\");\n}","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"if let Err(e) = app_handle.emit(\"progress\", &payload) {\n    tracing::warn!(\"emit failed (window closed?): {e}\");\n    // do not abort the long-running task for a transient emit failure\n}","preventionTips":["Treat Tauri emit errors as non-fatal in long-running tasks (window may be closed).","Register all state via `.manage(...)` before plugins read it.","Ensure all IPC payloads implement `Serialize`."],"tags":["tauri","events","ipc","rust"],"backgroundTag":null,"analyzedSha":"fad3f12a147d138388a66f0d92a02b2675f65294","analyzedAt":"2026-08-12T20:33:47.516Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}