{"record":{"id":"35c6ab8bd8e26de5","repo":"jdx/mise","slug":"message-io-error-reconstructed-from-serialized-kind-message","errorCode":null,"errorMessage":"{message} (io::Error reconstructed from serialized kind/message when reading workspace state)","messagePattern":"(.+?) \\(io::Error reconstructed from serialized kind/message when reading workspace state\\)","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"src/task/workspace.rs","lineNumber":408,"sourceCode":"    }\n\n    fn cache_key(&self, path: &Path) -> PathBuf {\n        normalize_filesystem_path(path)\n    }\n}\n\nimpl<T: Clone> CachedIo<T> {\n    fn from_result(result: io::Result<T>) -> Self {\n        match result {\n            Ok(value) => Self::Ok(value),\n            Err(error) => Self::Err(error.kind(), error.to_string()),\n        }\n    }\n\n    fn to_result(&self) -> io::Result<T> {\n        match self {\n            Self::Ok(value) => Ok(value.clone()),\n            Self::Err(kind, message) => Err(io::Error::new(*kind, message.clone())),\n        }\n    }\n}\n\nfn normalize_filesystem_path(path: &Path) -> PathBuf {\n    let mut normalized = PathBuf::new();\n    for component in path.components() {\n        match component {\n            Component::CurDir => {}\n            component => normalized.push(component.as_os_str()),\n        }\n    }\n    if normalized.as_os_str().is_empty() && !path.as_os_str().is_empty() {\n        normalized.push(\".\");\n    }\n    normalized\n}\n","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/task/workspace.rs#L390-L426","documentation":"When reading serialized workspace state, a previously persisted I/O failure is reconstructed with io::Error::new(kind, message). The panic/error surfaces if the stored kind or message cannot be turned back into a valid io::Error, meaning the saved state was corrupted or produced by an incompatible version.","triggerScenarios":"Calling code that reads workspace state via WorkspaceErr::to_result() when the stored variant is Err(kind, message); occurs only if the persisted kind/message pair is invalid or the state file was hand-edited or written by a mismatched mise version.","commonSituations":"A stale or corrupted mise.lock/workspace cache file on disk; upgrading/downgrading mise so the serialized state format changed; partially written state files after a crash.","solutions":["Delete the stale workspace state/cache file and rerun the task so it is regenerated","Ensure the same mise version wrote and reads the state file","Report corruption if it recurs; the state file should never be hand-edited"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before reading state\nif !state_path.exists() || metadata(&state_path)?.len() == 0 {\n    fs::remove_file(&state_path).ok(); // force regeneration\n}","typeGuard":"fn is_valid_kind(kind: &str) -> bool {\n    matches!(kind, \"NotFound\" | \"PermissionDenied\" | \"Other\")\n}","tryCatchPattern":null,"preventionTips":["Never hand-edit mise state files","Keep the same mise version within a project","Delete caches after crashes rather than repairing them"],"tags":["io","serialization","workspace","state"],"backgroundTag":"file-read-failed","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}