{"record":{"id":"5a1c9ac4889ce8f5","repo":"sxyazi/yazi","slug":"url-has-no-parent","errorCode":null,"errorMessage":"Url has no parent","messagePattern":"Url has no parent","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"yazi-scheduler/src/file/transaction.rs","lineNumber":20,"sourceCode":"\nuse yazi_fs::{cha::ChaMode, engine::Attrs};\nuse yazi_macro::ok_or_not_found;\nuse yazi_shared::{timestamp_us, url::{AsUrl, Url, UrlBuf}};\nuse yazi_vfs::{engine, unique_file};\n\npub(super) struct Transaction;\n\nimpl Transaction {\n\tpub(super) async fn tmp<U>(url: U) -> io::Result<UrlBuf>\n\twhere\n\t\tU: AsUrl,\n\t{\n\t\tSelf::tmp_impl(url.as_url()).await\n\t}\n\n\tasync fn tmp_impl(url: Url<'_>) -> io::Result<UrlBuf> {\n\t\tlet Some(parent) = url.parent() else {\n\t\t\tErr(io::Error::new(io::ErrorKind::InvalidInput, \"Url has no parent\"))?\n\t\t};\n\n\t\tlet mut h = foldhash::fast::FixedState::default().build_hasher();\n\t\turl.hash(&mut h);\n\t\ttimestamp_us().hash(&mut h);\n\n\t\tunique_file(parent.try_join(format!(\".{:x}.%tmp\", h.finish()))?, false).await\n\t}\n\n\tpub(super) async fn unlink<U>(url: U) -> io::Result<()>\n\twhere\n\t\tU: AsUrl,\n\t{\n\t\tlet url = url.as_url();\n\n\t\tlet cha = ok_or_not_found!(engine::symlink_metadata(url).await, return Ok(()));\n\t\tif cha.is_indirect() {\n\t\t\tengine::rename(Self::tmp(url).await?, url).await?;","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/sxyazi/yazi/blob/441b332de8b8800e70784cfbfb75369ab51ed9dd/yazi-scheduler/src/file/transaction.rs#L2-L38","documentation":"Error \"Url has no parent\" thrown in sxyazi/yazi.","triggerScenarios":"Thrown at yazi-scheduler/src/file/transaction.rs:20 when the library encounters an invalid state.","commonSituations":"Computing the parent of a root-level URL during a file transaction, e.g. moving a filesystem root.","solutions":["The URL has no parent (it is a root); ensure the file operation is not attempted on a root URL."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"441b332de8b8800e70784cfbfb75369ab51ed9dd","analyzedAt":"2026-08-19T05:27:26.468Z","contentChangedAt":"2026-08-19T05:27:26.468Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}