{"record":{"id":"11398c2cd9cccd47","repo":"janhq/jan","slug":"io-error-0-11398c","errorCode":null,"errorMessage":"IO error: {0}","messagePattern":"IO error: (.+?)","errorType":"error_code","errorClass":"ServerError","httpStatus":null,"severity":"error","filePath":"src-tauri/plugins/tauri-plugin-mlx/src/error.rs","lineNumber":62,"sourceCode":"                \"Out of memory. The model requires more RAM than available.\".into(),\n                Some(stderr.into()),\n            );\n        }\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            ),","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/janhq/jan/blob/7205d770c1e097c3daf35a911176410e93bc5564/src-tauri/plugins/tauri-plugin-mlx/src/error.rs#L44-L80","documentation":"ServerError::Io wraps a std::io::Error raised inside the tauri-plugin-mlx server and displays as \"IO error: {0}\". It is produced via `#[from]` whenever an IO operation (file read/write, process spawn, socket) fails while managing the MLX server. It is a transparent wrapper over the OS-level error.","triggerScenarios":"Starting/stopping the MLX server when a log or model file can't be opened, the server binary can't be spawned, or a port/socket operation fails with an OS error.","commonSituations":"Wrong model or working-directory paths; missing execute permissions on the server binary; disk-full or permission-denied conditions; port already bound surfacing as an OS error.","solutions":["Inspect the inner io::Error (source/kind) for the precise OS cause (NotFound, PermissionDenied, etc.).","Fix the referenced path: confirm the file/binary exists and has correct permissions.","Check disk space and directory writability for logs/temp files.","If it's a socket error, free the occupied port or choose another one."],"exampleFix":"// before\nlet server = Server::start(config).unwrap();\n\n// after\nlet server = Server::start(config).map_err(|e| match &e {\n    ServerError::Io(io) if io.kind() == std::io::ErrorKind::NotFound => {\n        anyhow!(\"server binary or model path missing: {}\", io)\n    }\n    other => anyhow!(\"server start failed: {other}\"),\n})?;","handlingStrategy":"try-catch","validationCode":"// Rust: preflight path checks before starting the server\nfn path_ok(p: &Path) -> bool {\n    p.exists() && std::fs::metadata(p).map(|m| !m.permissions().readonly()).unwrap_or(false)\n}","typeGuard":"fn as_io_error(err: &ServerError) -> Option<&std::io::Error> {\n    match err { ServerError::Io(e) => Some(e), _ => None }\n}","tryCatchPattern":"match Server::start(cfg) {\n    Err(ServerError::Io(io)) => match io.kind() {\n        std::io::ErrorKind::NotFound => bail!(\"missing file: {io}\"),\n        std::io::ErrorKind::PermissionDenied => bail!(\"fix permissions: {io}\"),\n        _ => bail!(\"io failure: {io}\"),\n    },\n    other => other?,\n}","preventionTips":["Verify all file paths and executable permissions before server startup.","Check free disk space where the server writes logs/temp files.","Probe ports for availability before binding."],"tags":["io","rust","tauri","mlx"],"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"}