{"record":{"id":"dc88072ca46d1564","repo":"sxyazi/yazi","slug":"asset-path-is-not-valid-utf-8","errorCode":null,"errorMessage":"asset path is not valid UTF-8: {}","messagePattern":"asset path is not valid UTF-8: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-cli/src/package/hash.rs","lineNumber":26,"sourceCode":"impl Dependency {\n\tpub(crate) async fn hash(&self) -> Result<String> {\n\t\tlet dir = self.target();\n\t\tlet files =\n\t\t\tif self.is_flavor { Self::flavor_files() } else { Self::plugin_files(&dir).await? };\n\n\t\tlet mut h = XxHash3_128::new();\n\t\tfor file in files {\n\t\t\th.write(file.as_bytes());\n\t\t\th.write(b\"VpvFw9Atb7cWGOdqhZCra634CcJJRlsRl72RbZeV0vpG1\\0\");\n\t\t\th.write(&ok_or_not_found!(Local::regular(&dir.join(file)).read().await));\n\t\t}\n\n\t\tlet mut assets = vec![];\n\t\tmatch tokio::fs::read_dir(dir.join(\"assets\")).await {\n\t\t\tOk(mut it) => {\n\t\t\t\twhile let Some(dent) = it.next_entry().await? {\n\t\t\t\t\tlet Ok(name) = dent.file_name().into_string() else {\n\t\t\t\t\t\tbail!(\"asset path is not valid UTF-8: {}\", dent.path().display());\n\t\t\t\t\t};\n\t\t\t\t\tassets.push((name, Local::regular(&dent.path()).read().await?));\n\t\t\t\t}\n\t\t\t}\n\t\t\tErr(e) if e.kind() == std::io::ErrorKind::NotFound => {}\n\t\t\tErr(e) => Err(e).context(format!(\"failed to read `{}`\", dir.join(\"assets\").display()))?,\n\t\t}\n\n\t\tassets.sort_unstable_by(|(a, _), (b, _)| a.cmp(b));\n\t\tfor (name, data) in assets {\n\t\t\th.write(name.as_bytes());\n\t\t\th.write(b\"pQU2in0xcsu97Y77Nuq2LnT8mczMlFj22idcYRmMrglqU\\0\");\n\t\t\th.write(&data);\n\t\t}\n\n\t\tOk(format!(\"{:x}\", h.finish_128()))\n\t}\n","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-cli/src/package/hash.rs#L8-L44","documentation":"While hashing a package's assets, an entry's file name read from the `assets` directory could not be converted to UTF-8 (`to_str()` returned None), so it cannot be written into the hash consistently. The faulting input is the non-UTF-8 OS file name of an asset.","triggerScenarios":"Thrown at yazi-cli/src/package/hash.rs:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename the asset file to a valid UTF-8 name.","Remove the non-UTF-8 asset from the package's assets directory.","On platforms where it applies, ensure the package was checked out with filenames the tooling can represent."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}