sxyazi/yazi · error
not a list of Files
Error message
not a list of Files
What it means
TryFrom<Data> for Files requires the Data value to be the List variant whose elements each convert into a File. The bail fires when the Data is any other variant (e.g. a string, integer, or map). It is a shape/type validation error when converting plugin-provided or deserialized data into a file list.
Source
Thrown at yazi-fs/src/file/data.rs:29
fn try_from(value: Data) -> Result<Self, Self::Error> {
value.into_any::<Self>().ok_or_else(|| anyhow!("not a File"))
}
}
impl TryFrom<&Data> for File {
type Error = anyhow::Error;
fn try_from(value: &Data) -> Result<Self, Self::Error> {
value.as_any::<Self>().cloned().ok_or_else(|| anyhow!("not a File"))
}
}
impl TryFrom<Data> for Files {
type Error = anyhow::Error;
fn try_from(value: Data) -> Result<Self, Self::Error> {
let Data::List(files) = value else { bail!("not a list of Files") };
files.into_iter().map(File::try_from).collect::<Result<_, _>>().map(Self)
}
}
impl TryFrom<&Data> for Files {
type Error = anyhow::Error;
fn try_from(value: &Data) -> Result<Self, Self::Error> {
let Data::List(files) = value else { bail!("not a list of Files") };
files.iter().map(File::try_from).collect::<Result<_, _>>().map(Self)
}
}
View on GitHub (pinned to 5f901b886b)
Solutions
- Inspect the Data variant actually produced by your fetch/preload plugin and ensure it returns a list of File-shaped tables.
- Match the expected schema for the plugin type you are implementing (check docs/examples of existing fetchers).
- Add a shape check on the producer side so bad payloads are rejected with a clearer message.
Example fix
// before (Lua fetcher)
return fields -- single table
// after
return { fields } -- list of File tables Defensive patterns
Strategy: type-guard
Validate before calling
// Lua plugin side: ensure a list of file tables is returned local ok = type(result) == "table" and #result > 0 and type(result[1]) == "table"
Type guard
// Rust: narrow the Data variant before converting
fn as_file_list(data: &Data) -> Option<&Vec<Data>> {
match data { Data::List(items) => Some(items), _ => None }
} Try / catch
let files = Files::try_from(data).map_err(|e| anyhow!("fetcher returned invalid payload: {e}"))?; Prevention
- Match the documented fetch/preload return schema exactly (list of file tables)
- Validate plugin payloads at the Lua boundary with clear errors
- Bump/test plugins after schema changes between versions
When it happens
Trigger: Calling Files::try_from(data) with a Data built from a scalar (Data::String, Data::Integer, etc.) instead of Data::List of File-convertible values; a fetch/preloader returning the wrong payload shape.
Common situations: A Lua fetch/preload plugin returning a single table-of-fields or a string instead of a list of file tables; protocol/config changes where the payload schema changed between versions.
Related errors
AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02).
Data as JSON: /api/errors/5566c0856a4b2468.
Report an issue: GitHub.