{"record":{"id":"4ba5def18fb95e72","repo":"janhq/jan","slug":"io-error-0","errorCode":null,"errorMessage":"IO error: {0}","messagePattern":"IO error: (.+?)","errorType":"exception","errorClass":"ServerError","httpStatus":null,"severity":"error","filePath":"src-tauri/plugins/tauri-plugin-llamacpp/src/error.rs","lineNumber":199,"sourceCode":"\nfn basename(path: &str) -> &str {\n    path.rsplit(['/', '\\\\']).next().unwrap_or(path)\n}\n\nfn push_library(found: &mut Vec<String>, candidate: &str) {\n    let candidate = candidate.trim_matches(['\\'', '\"', '(', ')', ',', '.'].as_ref());\n    if looks_like_library(candidate) && !found.iter().any(|f| f == candidate) {\n        found.push(candidate.to_string());\n    }\n}\n\n// Error type for server commands\n#[derive(Debug, thiserror::Error)]\npub enum ServerError {\n    #[error(transparent)]\n    Llamacpp(#[from] LlamacppError),\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    #[error(\"Invalid argument: {0}\")]\n    InvalidArgument(String),\n}\n\n// impl serialization for tauri\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: LlamacppError = match self {\n            ServerError::Llamacpp(err) => err.clone(),\n            ServerError::Io(e) => LlamacppError::new(","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/janhq/jan/blob/7205d770c1e097c3daf35a911176410e93bc5564/src-tauri/plugins/tauri-plugin-llamacpp/src/error.rs#L181-L217","documentation":"ServerError::Io wraps std::io::Error from command handlers in the plugin, displayed as \"IO error: {0}\". It is produced automatically via #[from] whenever a server command performs file or process I/O that fails. It lets the ServerError enum cover filesystem and stdio failures without a bespoke variant.","triggerScenarios":"A #[tauri::command] returning ServerError performs std::io operations (reading model files, spawning the llama server process, writing temp files) and the underlying call returns Err(std::io::Error), converted by the #[from] impl.","commonSituations":"Model file missing or unreadable at the configured path, disk full when writing caches, permission denied on the llama-server binary, or process spawn failures (executable not found).","solutions":["Inspect the wrapped std::io::Error and its kind; check NotFound, PermissionDenied, etc.","Verify the configured model/binary paths exist and are readable/executable before invoking the command.","Check disk space and file permissions in the plugin's data directories.","If path-dependent, resolve with an absolute path and validate it on the frontend first."],"exampleFix":"// before: passing a relative, unverified model path\nlet path = \"models/foo.gguf\";\n// after: validate before calling the command\nlet path = std::path::absolute(\"models/foo.gguf\")?;\nif !path.exists() { return Err(ServerError::InvalidArgument(format!(\"missing model {}\", path.display()))); }","handlingStrategy":"validation","validationCode":"fn ensure_readable(path: &std::path::Path) -> Result<(), ServerError> {\n    let meta = std::fs::metadata(path).map_err(ServerError::Io)?;\n    if meta.is_file() { Ok(()) } else { Err(ServerError::InvalidArgument(format!(\"{} is not a file\", path.display()))) }\n}","typeGuard":null,"tryCatchPattern":"match cmd() {\n    Err(ServerError::Io(e)) => match e.kind() {\n        std::io::ErrorKind::NotFound => show(\"path not found\"),\n        std::io::ErrorKind::PermissionDenied => show(\"check permissions\"),\n        _ => show(&e.to_string()),\n    },\n    other => other,\n}","preventionTips":["Validate model/binary paths exist and are accessible before invoking commands.","Use absolute paths resolved at startup.","Check disk space for cache/write-heavy operations.","Verify the llama-server binary is present and executable after install."],"tags":["rust","io","tauri","file-system"],"backgroundTag":"file-read-failed","analyzedSha":"7205d770c1e097c3daf35a911176410e93bc5564","analyzedAt":"2026-09-17T14:27:30.100Z","contentChangedAt":"2026-09-17T14:27:30.100Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}