{"record":{"id":"e52e6566a9969234","repo":"sxyazi/yazi","slug":"trash-item-has-no-put-back-name","errorCode":null,"errorMessage":"trash item has no put-back name","messagePattern":"trash item has no put-back name","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"warning","filePath":"yazi-fs/src/trash/macos/ds_store.rs","lineNumber":46,"sourceCode":"\t\t\t\tb\"ptbN\" => location.name = Some(value.into()),\n\t\t\t\t_ => {}\n\t\t\t}\n\t\t}\n\n\t\tOk(locations)\n\t}\n\n\tpub(super) fn join(&self, rel: &Path) -> io::Result<PathBuf> {\n\t\tif !rel.is_relative() || rel.has_parent_component() {\n\t\t\treturn Err(io::Error::new(io::ErrorKind::InvalidInput, \"invalid trash entry path\"));\n\t\t}\n\n\t\tlet parent = self.parent.as_deref().ok_or_else(|| {\n\t\t\tio::Error::new(io::ErrorKind::InvalidData, \"trash item has no put-back location\")\n\t\t})?;\n\n\t\tlet name = self.name.as_deref().ok_or_else(|| {\n\t\t\tio::Error::new(io::ErrorKind::InvalidData, \"trash item has no put-back name\")\n\t\t})?;\n\n\t\tlet mut components = Path::new(name).components();\n\t\tif !matches!(components.next(), Some(Component::Normal(_))) || components.next().is_some() {\n\t\t\treturn Err(io::Error::new(io::ErrorKind::InvalidData, \"invalid trash put-back name\"));\n\t\t}\n\n\t\tlet top_path = Path::new(\"/\").join(parent).join(name);\n\t\tOk(if rel.as_os_str().is_empty() { top_path } else { top_path.join(rel) })\n\t}\n}\n","sourceCodeStart":28,"sourceCodeEnd":58,"githubUrl":"https://github.com/sxyazi/yazi/blob/94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2/yazi-fs/src/trash/macos/ds_store.rs#L28-L58","documentation":"Thrown by DsStore::join on macOS when a ~/.Trash/.DS_Store record has a ptbL (put-back parent) but no ptbN ('put-back name') field, so the original file name is unknown. It indicates partially-written or non-Finder trash metadata. Like its sibling error, it is swallowed with .ok() by list()/entry() and manifests as original == None on the entry.","triggerScenarios":"DsStore record for the trash item contains ptbL but lacks ptbN (record.value Ustr entries only matched the b\"ptbL\" arm), and ds.join() reaches self.name == None.","commonSituations":"Item trashed by a tool that writes location but not name metadata; .DS_Store corruption or partial rewrite; unusual Finder versions or per-volume .DS_Store behavior after moving disks between machines.","solutions":["Restore manually by moving the item out of ~/.Trash (its current name in the Trash is usable) or via Trash:rename.","Re-trash the item from Finder to regenerate complete ptbL/ptbN metadata, then restore.","Guard callers: treat entries with original == nil as non-restorable and prompt for a destination path."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"-- Lua: entries from list() carry original only when BOTH ptbL and ptbN parsed\nlocal restorable = {}\nfor _, e in ipairs(entries) do\n  if e.original ~= nil then table.insert(restorable, e) end\nend","typeGuard":"local function is_restorable(e) return e.original ~= nil end","tryCatchPattern":"local ok, err = trash:restore(restorable)\nif not ok then ya.notify({ title = \"Trash\", content = tostring(err), level = \"error\" }) end","preventionTips":["Check original on every entry before restore — it encodes both missing-ptbL and missing-ptbN cases.","Re-trash from Finder to regenerate complete put-back metadata.","Do not parse .DS_Store by hand; rely on the parsed original field."],"tags":["trash","macos","ds-store","put-back","metadata"],"backgroundTag":null,"analyzedSha":"94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2","analyzedAt":"2026-08-16T09:56:24.836Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}