sxyazi/yazi · error · io::Error
trash is not supported on this platform
Error message
trash is not supported on this platform
What it means
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.
Source
Thrown at yazi-fs/src/trash/unsupported/trash.rs:12
use std::{io, path::Path};
use super::super::{TrashEntries, TrashEntry, TrashId};
use crate::{cha::Cha, file::File};
pub struct Trash;
impl Trash {
pub fn new() -> io::Result<Self> { Ok(Self) }
pub fn list(&self, _entry: Option<&TrashEntry>) -> io::Result<Vec<TrashEntry>> {
Err(io::Error::new(io::ErrorKind::Unsupported, "trash is not supported on this platform"))
}
pub fn entry(&self, _id: &TrashId) -> io::Result<TrashEntry> {
Err(io::Error::new(io::ErrorKind::Unsupported, "trash is not supported on this platform"))
}
pub fn metadata(&self, _entry: &TrashEntry, _: bool) -> io::Result<Cha> {
Err(io::Error::new(io::ErrorKind::Unsupported, "trash is not supported on this platform"))
}
pub(crate) fn revalidate(
&self,
_entry: Option<&TrashEntry>,
_current: &File,
) -> io::Result<Option<File>> {
Err(io::Error::new(io::ErrorKind::Unsupported, "trash is not supported on this platform"))
}
View on GitHub (pinned to 94abcfa92f)
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.
Example fix
-- Lua: before
local items = ya.fs("trash"):list()
-- after: probe once, degrade gracefully
local trash = ya.fs("trash")
local items, err = trash:list()
if items == nil then
-- err.kind == "unsupported": disable trash features in this plugin
end Defensive patterns
Strategy: fallback
Validate before calling
-- Lua: capability probe at plugin init
local trash = ya.fs("trash")
local TRASH_OK = trash:list() ~= nil Try / catch
local items, err = trash:list()
if items == nil then
if err.kind == "unsupported" then return { items = {}, unsupported = true } end
error(err)
end Prevention
- Probe once, cache the result; Unsupported is permanent for the build.
- Platform-gate trash features (Android/iOS have no backend).
- Never retry Unsupported errors.
When it happens
Trigger: Calling ya.fs("trash"):list(...) in a yazi build for Android/iOS; any plugin that assumes the trash feature exists on all platforms.
Common situations: Running yazi or its plugin tests on Android (Termux native target), iOS, or cross-compiling plugins for mobile targets.
Related errors
- Unsupported OS for trash operation
- trash item is not a directory
- trash item is not a directory
- bundled rust-lld setup requires a Unix host
- restore target already exists: {to:?}
AI-assisted analysis of sxyazi/yazi@94abcfa92f (2026-08-16).
Data as JSON: /api/errors/f49b65da51388802.
Report an issue: GitHub.