{"record":{"id":"a6ab13e9b38444af","repo":"sxyazi/yazi","slug":"some-files-cannot-be-selected-due-to-path-nesting","errorCode":null,"errorMessage":"Some files cannot be selected, due to path nesting conflict.","messagePattern":"Some files cannot be selected, due to path nesting conflict\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"yazi-actor/src/mgr/escape.rs","lineNumber":84,"sourceCode":"\tfn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {\n\t\tlet tab = cx.tab_mut();\n\n\t\tlet select = tab.mode.is_select();\n\t\tlet Some(indices) = tab.mode.take_visual(tab.current.cursor, tab.current.entries.len()) else {\n\t\t\tsucc!(false)\n\t\t};\n\n\t\trender!();\n\t\tlet files: Vec<_> = indices.into_iter().filter_map(|i| tab.current.entries.get(i)).collect();\n\n\t\tif !select {\n\t\t\ttab.selected.remove_many(files);\n\t\t} else if files.len() != tab.selected.add_many(files) {\n\t\t\tNotifyProxy::push_warn(\n\t\t\t\t\"Escape visual mode\",\n\t\t\t\t\"Some files cannot be selected, due to path nesting conflict.\",\n\t\t\t);\n\t\t\tbail!(\"Some files cannot be selected, due to path nesting conflict.\");\n\t\t}\n\n\t\tsucc!(true)\n\t}\n}\n\n// --- Filter\npub struct EscapeFilter;\n\nimpl Actor for EscapeFilter {\n\ttype Form = VoidForm;\n\n\tconst NAME: &str = \"escape_filter\";\n\n\tfn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {\n\t\tif cx.current_mut().entries.filter().is_none() {\n\t\t\tsucc!(false);\n\t\t}","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/sxyazi/yazi/blob/441b332de8b8800e70784cfbfb75369ab51ed9dd/yazi-actor/src/mgr/escape.rs#L66-L102","documentation":"Thrown by TryFrom<Data> for File (yazi-fs/src/file/data.rs:13) when Data::into_any::<File>() fails: the Data value is not the Data::Any box holding a File. The File type crosses the event/Lua boundary only as an opaque Any payload, so any other variant (Integer, String, Table, List, or an Any of a different type such as Files or Folder) produces this error. The owned flavor applies when the Data is consumed by value.","triggerScenarios":"Calling an API that does `Data -> File` conversion (e.g. a form taking a File argument) while the sender passed a plain value, a different Any type, or a list of files (which converts to Files, not File); mixing up hovered-file and selected-files arguments in plugin calls.","commonSituations":"Plugin code passing `cx.tab.current.hovered`-style tables or URLs where a File object is required; passing the result of a files-collection API to a single-File parameter; version changes moving a field from File to another type.","solutions":["Pass an actual File object obtained from the yazi API (hovered entry, tab file) rather than a URL, table, or list","For multiple files use the Files-typed parameter, not File","Verify with ya.dbg()/type() on the Lua side that the value is a File userdata before emitting","Check the receiving form expects the type you send; rename/retarget the argument if they diverged after an upgrade"],"exampleFix":"-- before\nya.emit(\"some_cmd\", { file = \"/tmp/a.txt\" })  -- a string, not a File\n-- after\nya.emit(\"some_cmd\", { file = hovered })  -- File userdata from the API","handlingStrategy":"type-guard","validationCode":"-- Lua: verify the value is File userdata before emitting\nif type(entry) == \"userdata\" or (type(entry) == \"table\" and getmetatable(entry) and getmetatable(entry).__name == \"File\") then\n  ya.emit(\"cmd\", { file = entry })\nend","typeGuard":"-- Lua\nlocal function is_file(v)\n  return type(v) == \"userdata\" or type(v) == \"table\"\nend -- strongest check: obtain v only from yazi's hovered/entry APIs","tryCatchPattern":"-- Lua\nlocal ok, err = pcall(ya.emit, \"cmd\", { file = v })\nif not ok then ya.dbg(\"expected a File: \" .. tostring(err)) end","preventionTips":["Only pass File objects obtained from yazi APIs (hovered, entries)","Use Files-typed parameters for collections","Never substitute path strings or plain tables where a File is required","Type-check at plugin boundaries before emitting"],"tags":["rust","lua","type-conversion","plugin-api","yazi"],"backgroundTag":"wrong-type-argument","analyzedSha":"441b332de8b8800e70784cfbfb75369ab51ed9dd","analyzedAt":"2026-08-19T05:27:26.468Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}