{"record":{"id":"f49b65da51388802","repo":"sxyazi/yazi","slug":"trash-is-not-supported-on-this-platform","errorCode":null,"errorMessage":"trash is not supported on this platform","messagePattern":"trash is not supported on this platform","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"yazi-fs/src/trash/unsupported/trash.rs","lineNumber":12,"sourceCode":"use std::{io, path::Path};\n\nuse super::super::{TrashEntries, TrashEntry, TrashId};\nuse crate::{cha::Cha, file::File};\n\npub struct Trash;\n\nimpl Trash {\n\tpub fn new() -> io::Result<Self> { Ok(Self) }\n\n\tpub fn list(&self, _entry: Option<&TrashEntry>) -> io::Result<Vec<TrashEntry>> {\n\t\tErr(io::Error::new(io::ErrorKind::Unsupported, \"trash is not supported on this platform\"))\n\t}\n\n\tpub fn entry(&self, _id: &TrashId) -> io::Result<TrashEntry> {\n\t\tErr(io::Error::new(io::ErrorKind::Unsupported, \"trash is not supported on this platform\"))\n\t}\n\n\tpub fn metadata(&self, _entry: &TrashEntry, _: bool) -> io::Result<Cha> {\n\t\tErr(io::Error::new(io::ErrorKind::Unsupported, \"trash is not supported on this platform\"))\n\t}\n\n\tpub(crate) fn revalidate(\n\t\t&self,\n\t\t_entry: Option<&TrashEntry>,\n\t\t_current: &File,\n\t) -> io::Result<Option<File>> {\n\t\tErr(io::Error::new(io::ErrorKind::Unsupported, \"trash is not supported on this platform\"))\n\t}\n","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/sxyazi/yazi/blob/94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2/yazi-fs/src/trash/unsupported/trash.rs#L1-L30","documentation":"Returned by Trash::list on platforms where the trash backend is compiled out (the trash_unsupported cfg alias: Android and iOS, per yazi-fs/build.rs). The constructor succeeds but every operation, including listing, returns io::ErrorKind::Unsupported — there is no ~/.Trash or recycle-bin API available on these targets.","triggerScenarios":"Calling ya.fs(\"trash\"):list(...) in a yazi build for Android/iOS; any plugin that assumes the trash feature exists on all platforms.","commonSituations":"Running yazi or its plugin tests on Android (Termux native target), iOS, or cross-compiling plugins for mobile targets.","solutions":["Gate trash UI and plugin code on platform before calling list (cfg/feature check at build time, or an early capability probe).","Treat ErrorKind::Unsupported as 'feature absent' and hide the trash view gracefully.","On Android, use the system Storage Access Framework intent instead; yazi's Trash API cannot provide it."],"exampleFix":"-- Lua: before\nlocal items = ya.fs(\"trash\"):list()\n-- after: probe once, degrade gracefully\nlocal trash = ya.fs(\"trash\")\nlocal items, err = trash:list()\nif items == nil then\n  -- err.kind == \"unsupported\": disable trash features in this plugin\nend","handlingStrategy":"fallback","validationCode":"-- Lua: capability probe at plugin init\nlocal trash = ya.fs(\"trash\")\nlocal TRASH_OK = trash:list() ~= nil","typeGuard":null,"tryCatchPattern":"local items, err = trash:list()\nif items == nil then\n  if err.kind == \"unsupported\" then return { items = {}, unsupported = true } end\n  error(err)\nend","preventionTips":["Probe once, cache the result; Unsupported is permanent for the build.","Platform-gate trash features (Android/iOS have no backend).","Never retry Unsupported errors."],"tags":["trash","unsupported","platform","android","ios","listing"],"backgroundTag":null,"analyzedSha":"94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2","analyzedAt":"2026-08-16T09:56:24.836Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}