{"record":{"id":"5566c0856a4b2468","repo":"sxyazi/yazi","slug":"not-a-list-of-files","errorCode":null,"errorMessage":"not a list of Files","messagePattern":"not a list of Files","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-fs/src/file/data.rs","lineNumber":29,"sourceCode":"\n\tfn try_from(value: Data) -> Result<Self, Self::Error> {\n\t\tvalue.into_any::<Self>().ok_or_else(|| anyhow!(\"not a File\"))\n\t}\n}\n\nimpl TryFrom<&Data> for File {\n\ttype Error = anyhow::Error;\n\n\tfn try_from(value: &Data) -> Result<Self, Self::Error> {\n\t\tvalue.as_any::<Self>().cloned().ok_or_else(|| anyhow!(\"not a File\"))\n\t}\n}\n\nimpl TryFrom<Data> for Files {\n\ttype Error = anyhow::Error;\n\n\tfn try_from(value: Data) -> Result<Self, Self::Error> {\n\t\tlet Data::List(files) = value else { bail!(\"not a list of Files\") };\n\t\tfiles.into_iter().map(File::try_from).collect::<Result<_, _>>().map(Self)\n\t}\n}\n\nimpl TryFrom<&Data> for Files {\n\ttype Error = anyhow::Error;\n\n\tfn try_from(value: &Data) -> Result<Self, Self::Error> {\n\t\tlet Data::List(files) = value else { bail!(\"not a list of Files\") };\n\t\tfiles.iter().map(File::try_from).collect::<Result<_, _>>().map(Self)\n\t}\n}\n","sourceCodeStart":11,"sourceCodeEnd":42,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-fs/src/file/data.rs#L11-L42","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (Lua fetcher)\nreturn fields -- single table\n// after\nreturn { fields } -- list of File tables","handlingStrategy":"type-guard","validationCode":"// Lua plugin side: ensure a list of file tables is returned\nlocal ok = type(result) == \"table\" and #result > 0 and type(result[1]) == \"table\"","typeGuard":"// Rust: narrow the Data variant before converting\nfn as_file_list(data: &Data) -> Option<&Vec<Data>> {\n    match data { Data::List(items) => Some(items), _ => None }\n}","tryCatchPattern":"let files = Files::try_from(data).map_err(|e| anyhow!(\"fetcher returned invalid payload: {e}\"))?;","preventionTips":["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"],"tags":["type-conversion","data-validation","plugin","schema"],"backgroundTag":"unexpected-data-shape","analyzedSha":"5f901b886b14de1f17460b6e52e9de5d67f8aba9","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}