{"record":{"id":"f3dcceed7306a0de","repo":"sxyazi/yazi","slug":"trash-item-has-no-put-back-location-f3dcce","errorCode":null,"errorMessage":"trash item has no put-back location","messagePattern":"trash item has no put-back location","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"yazi-fs/src/trash/windows/trash.rs","lineNumber":32,"sourceCode":"\nimpl Trash {\n\tpub(crate) fn new() -> io::Result<Self> {\n\t\tCOM.with(|result| {\n\t\t\tresult.as_ref().map(|_| Self).map_err(|e| io::Error::new(e.kind(), e.to_string()))\n\t\t})\n\t}\n\n\tpub(crate) fn list(&self, entry: Option<&TrashEntry>) -> io::Result<Vec<TrashEntry>> {\n\t\tlet Some(entry) = entry else {\n\t\t\treturn self.tops();\n\t\t};\n\n\t\tif !entry.lcha.is_dir() || entry.lcha.is_indirect() {\n\t\t\treturn Err(io::Error::new(io::ErrorKind::InvalidInput, \"trash item is not a directory\"));\n\t\t}\n\n\t\tlet original = entry.original.as_deref().ok_or_else(|| {\n\t\t\tio::Error::new(io::ErrorKind::NotFound, \"trash item has no put-back location\")\n\t\t})?;\n\n\t\tself\n\t\t\t.resolve(entry)?\n\t\t\t.children()?\n\t\t\t.into_iter()\n\t\t\t.map(|item| {\n\t\t\t\tlet name = item.display_name(SIGDN_PARENTRELATIVEPARSING)?;\n\t\t\t\titem.entry(entry.id.child(&name)?, Some(original.join(&name)))\n\t\t\t})\n\t\t\t.collect()\n\t}\n\n\tpub(crate) fn entry(&self, id: &TrashId) -> io::Result<TrashEntry> {\n\t\tlet top = ShellItem::top(id.top())?;\n\t\tlet original = top.original()?;\n\t\tif !id.has_rel() {\n\t\t\treturn top.entry(id.clone(), Some(original));","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/sxyazi/yazi/blob/94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2/yazi-fs/src/trash/windows/trash.rs#L14-L50","documentation":"Thrown by the Windows trash backend when expanding (listing children of) a trashed directory whose TrashEntry carries no `original` put-back path. Child entries are built as `original.join(name)`, so without a recorded original location the expansion cannot proceed. The Recycle Bin normally records the original location, but items from some network/removable drives or entries reconstructed from a stale TrashId may lack it.","triggerScenarios":"Calling `Trash::list(Some(&entry))` on Windows where `entry.lcha` is a directory and not a symlink, but `entry.original` is None — e.g. a trashed directory deleted from a network share, or an entry revived from a cached TrashId without put-back info.","commonSituations":"Browsing the trash of a machine with items deleted from UNC paths or removable media; restoring a yazi session whose trash state went stale after the Recycle Bin changed; automated tests that construct TrashEntry values without `original`.","solutions":["Check `entry.original.is_some()` before calling `list(Some(&entry))` and treat the entry as an opaque leaf when it is None","If the entry should be expandable, re-list the bin from the top (`list(None)`) to rebuild entries with fresh original locations","If put-back info is genuinely unrecorded by the shell, only permanent removal is possible — do not retry listing"],"exampleFix":"// before\nlet children = trash.list(Some(&entry))?;\n\n// after\nif entry.original.is_none() {\n    // Shell recorded no put-back location; cannot expand children\n    return Ok(vec![]);\n}\nlet children = trash.list(Some(&entry))?;","handlingStrategy":"validation","validationCode":"// Rust\nlet expandable = entry.lcha.is_dir() && !entry.lcha.is_indirect() && entry.original.is_some();\nif expandable {\n    let children = trash.list(Some(&entry))?;\n}","typeGuard":"fn can_expand_trash(e: &TrashEntry) -> bool {\n    e.lcha.is_dir() && !e.lcha.is_indirect() && e.original.is_some()\n}","tryCatchPattern":"match trash.list(Some(&entry)) {\n    Err(e) if e.kind() == io::ErrorKind::NotFound && e.to_string().contains(\"put-back\") => Ok(vec![]),\n    other => other,\n}","preventionTips":["Check entry.original before expanding trash directories","Re-list the bin from the top when trash state may be stale","Do not construct TrashEntry values without original in tests/fixtures"],"tags":["windows","trash","recycle-bin","filesystem"],"backgroundTag":null,"analyzedSha":"94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2","analyzedAt":"2026-08-16T09:56:24.836Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}