janhq/jan · error · ServerError::Tauri
Tauri error: {0}
Error message
Tauri error: {0} What it means
The ServerError::Tauri variant (#[from] tauri::Error) in the tauri-plugin-llamacpp plugin. Its Display is "Tauri error: {0}". On serialization it is mapped to a LlamacppError with code INTERNAL_ERROR and message "An internal application error occurred.", the Tauri error string kept in details. It captures failures from the Tauri runtime/IPC layer rather than llama.cpp itself.
Source
Thrown at src-tauri/plugins/tauri-plugin-llamacpp/src/error.rs:200
}
fn push_library(found: &mut Vec<String>, candidate: &str) {
let candidate = candidate.trim_matches(['\'', '"', '(', ')', ',', '.'].as_ref());
if looks_like_library(candidate) && !found.iter().any(|f| f == candidate) {
found.push(candidate.to_string());
}
}
// Error type for server commands
#[derive(Debug, thiserror::Error)]
pub enum ServerError {
#[error(transparent)]
Llamacpp(#[from] LlamacppError),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Tauri error: {0}")]
Tauri(#[from] tauri::Error),
#[error("Invalid argument: {0}")]
InvalidArgument(String),
}
// impl serialization for tauri
impl serde::Serialize for ServerError {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let error_to_serialize: LlamacppError = match self {
ServerError::Llamacpp(err) => err.clone(),
ServerError::Io(e) => LlamacppError::new(
ErrorCode::IoError,
"An input/output error occurred.".into(),
Some(e.to_string()),View on GitHub (pinned to fad3f12a14)
Solutions
- Verify any Tauri managed state is registered before the command runs.
- Guard event emissions against missing/disposed webview targets.
- Align the plugin with the installed Tauri version (API surface changes).
- Inspect the serialized `details` for the specific tauri::Error variant.
Example fix
// Rust
pub fn emit_progress(app: AppHandle) -> ServerResult<()> {
app.emit("progress", 1)?; // tauri::Error -> ServerError::Tauri
Ok(())
}
// Frontend
catch (e) {
const err = JSON.parse(e.message)
if (err.code === 'INTERNAL_ERROR') logger.error('Tauri runtime error:', err.details)
} Defensive patterns
Strategy: try-catch
Try / catch
try {
await invoke('start_server', { ... })
} catch (e) {
const err = JSON.parse((e as any).message ?? '{}')
if (err.code === 'INTERNAL_ERROR') reportRuntimeError(err.details)
else throw e
} Prevention
- Register all managed state the command expects.
- Guard event emissions against disposed webviews.
- Keep the plugin and Tauri versions aligned.
When it happens
Trigger: A command calls a Tauri API (managed state access, event emit, app handle operation) that returns tauri::Error, and `?` converts it into ServerError::Tauri.
Common situations: Emitting an event to a webview that no longer exists; accessing managed state that was not registered; IPC/app-handle misuse; Tauri version mismatch causing API errors.
Related errors
- ${String(e)}
- ${e}
- LlamacppError {{ code: {code:?}, message: "{message}" }}
- IO error: {0}
- Invalid argument: {0}
AI-assisted analysis of janhq/jan@fad3f12a14 (2026-08-12).
Data as JSON: /api/errors/24f50005cb7dc6ea.
Report an issue: GitHub.