{"record":{"id":"b42dc57394e9491f","repo":"sxyazi/yazi","slug":"unknown-error-kind-s","errorCode":null,"errorMessage":"unknown error kind: {s}","messagePattern":"unknown error kind: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-shim/src/fs/serde.rs","lineNumber":100,"sourceCode":"\t\t\"WriteZero\" => K::WriteZero,\n\t\t\"StorageFull\" => K::StorageFull,\n\t\t\"NotSeekable\" => K::NotSeekable,\n\t\t\"QuotaExceeded\" => K::QuotaExceeded,\n\t\t\"FileTooLarge\" => K::FileTooLarge,\n\t\t\"ResourceBusy\" => K::ResourceBusy,\n\t\t\"ExecutableFileBusy\" => K::ExecutableFileBusy,\n\t\t\"Deadlock\" => K::Deadlock,\n\t\t\"CrossesDevices\" => K::CrossesDevices,\n\t\t\"TooManyLinks\" => K::TooManyLinks,\n\t\t\"InvalidFilename\" => K::InvalidFilename,\n\t\t\"ArgumentListTooLong\" => K::ArgumentListTooLong,\n\t\t\"Interrupted\" => K::Interrupted,\n\t\t\"Unsupported\" => K::Unsupported,\n\t\t\"UnexpectedEof\" => K::UnexpectedEof,\n\t\t\"OutOfMemory\" => K::OutOfMemory,\n\t\t// \"InProgress\" => K::InProgress,\n\t\t\"Other\" => K::Other,\n\t\t_ => bail!(\"unknown error kind: {s}\"),\n\t})\n}\n\nimpl Serialize for Error {\n\tfn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>\n\twhere\n\t\tS: Serializer,\n\t{\n\t\t#[derive(Serialize)]\n\t\t#[serde(tag = \"type\", rename_all = \"kebab-case\")]\n\t\tenum Shadow<'a> {\n\t\t\tKind { kind: &'a str },\n\t\t\tRaw { code: i32 },\n\t\t\tDyn { kind: &'a str, code: Option<i32>, message: &'a str },\n\t\t}\n\n\t\tmatch self {\n\t\t\tSelf::Kind(kind) => Shadow::Kind { kind: kind_to_str(*kind) }.serialize(serializer),","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-shim/src/fs/serde.rs#L82-L118","documentation":"`kind_from_str` deserializes an io::ErrorKind from its standard Debug/serde string form (\"NotFound\", \"PermissionDenied\", \"Interrupted\", etc.). Any unrecognized string bails with \"unknown error kind: {s}\". This fires during `Deserialize for Error` when the serialized error payload contains a kind name this version of the shim doesn't map (note some kinds like \"InProgress\" are commented out).","triggerScenarios":"Deserializing a serialized io::Error whose `kind` field holds a string not in the match list — e.g. a newer/older Rust stdio kind name, a platform-specific kind, or a hand-written/foreign payload with a typo'd kind string.","commonSituations":"Task/job state files or IPC messages written by a different yazi version whose std ErrorKind naming differs; hand-crafted test fixtures with invalid kind strings; cross-version serialization where a new ErrorKind variant round-trips through an older binary.","solutions":["Fix the serialized payload's `kind` value to a recognized name (NotFound, PermissionDenied, Interrupted, Unsupported, UnexpectedEof, OutOfMemory, Other).","Use \"Other\" as the fallback kind when serializing errors with exotic kinds.","Upgrade or downgrade so both writer and reader use the same yazi/io version.","If you control the producer, map unknown kinds to K::Other before serialization instead of emitting raw names."],"exampleFix":"// before\nserde_json::to_string(&err)?; // kind \"CategoryNotFound\" -> fails to deserialize\n// after\nlet kind = if matches_standard_kind(err.kind()) { err.kind() } else { std::io::ErrorKind::Other };\nserde_json::to_string(&io::Error::new(kind, err.to_string()))?;","handlingStrategy":"fallback","validationCode":"const KNOWN_KINDS: &[&str] = &[\"NotFound\",\"PermissionDenied\",\"Interrupted\",\"Unsupported\",\"UnexpectedEof\",\"OutOfMemory\",\"Other\"];\nfn is_known_kind(s: &str) -> bool { KNOWN_KINDS.contains(&s) }","typeGuard":null,"tryCatchPattern":"let err: ShimError = serde_json::from_str(&raw)\n    .unwrap_or_else(|_| ShimError::new(std::io::ErrorKind::Other, raw.clone()));","preventionTips":["Map exotic io::ErrorKinds to ErrorKind::Other before serializing.","Keep writer and reader on the same yazi/Rust version.","Sanitize third-party or hand-written payloads with is_known_kind first.","When std adds a new ErrorKind, update the shim's match table."],"tags":["rust","serialization","io","yazi-shim"],"backgroundTag":"unknown-enum-variant-deserialization","analyzedSha":"5f901b886b14de1f17460b6e52e9de5d67f8aba9","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}