{"record":{"id":"9413d15e9a1fa743","repo":"sxyazi/yazi","slug":"invalid-path","errorCode":null,"errorMessage":"Invalid path","messagePattern":"Invalid path","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-actor/src/mgr/bulk_create.rs","lineNumber":74,"sourceCode":"\t\t});\n\t\tsucc!()\n\t}\n}\n\nimpl BulkCreate {\n\tasync fn r#do(cwd: UrlBuf, todo: Vec<Entry<'_>>) -> Result<()> {\n\t\twritef!(TTY.writer(), \"{}\\n\", EraseDisplay::All)?;\n\t\tif todo.is_empty() {\n\t\t\treturn Ok(());\n\t\t} else if !Self::ask_continue(&todo, None)? {\n\t\t\treturn Ok(()); // TODO: support `bulk_exit`?\n\t\t}\n\n\t\tlet _permit = WATCHER.acquire().await.unwrap();\n\t\tlet (mut failed, mut succeeded) = (vec![], Vec::with_capacity(todo.len()));\n\t\tfor entry in todo {\n\t\t\tlet Ok(dist) = cwd.try_join(entry.path) else {\n\t\t\t\tfailed.push((entry, anyhow!(\"Invalid path\")));\n\t\t\t\tcontinue;\n\t\t\t};\n\n\t\t\tlet result: io::Result<()> = if entry.is_dir {\n\t\t\t\tengine::create_dir_all(&dist).await\n\t\t\t} else if let Some(parent) = dist.parent() {\n\t\t\t\tengine::create_dir_all(parent).await.ok();\n\t\t\t\tengine::create_new(&dist).await.map(|_| ())\n\t\t\t} else {\n\t\t\t\tErr(io::Error::other(\"No parent directory\"))\n\t\t\t};\n\n\t\t\tif let Err(e) = result {\n\t\t\t\tfailed.push((entry, e.into()));\n\t\t\t} else if let Ok(f) = engine::file(dist).await {\n\t\t\t\tsucceeded.push(f);\n\t\t\t} else {\n\t\t\t\tfailed.push((entry, anyhow!(\"Failed to retrieve file info\")));","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-actor/src/mgr/bulk_create.rs#L56-L92","documentation":"During bulk creation, each entry's path is joined onto the current working directory with try_join. If the join fails (e.g. an absolute path or a path that cannot be merged), the entry is recorded as failed with \"Invalid path\" instead of aborting the whole batch. It is a per-entry validation error inside r#do.","triggerScenarios":"bulk_create entry whose `path` is absolute (starts with `/`) or otherwise cannot be joined onto `cwd` by try_join.","commonSituations":"Plugin passing absolute paths to bulk create; user input containing a leading slash; paths with components that fail the join constraints.","solutions":["Pass relative paths (relative to the current directory) in the bulk_create entries.","Strip leading slashes or normalize the path before submitting the entry.","Resolve the desired absolute path yourself and use a different API if absolute targets are required."],"exampleFix":"// before\n{ path: \"/tmp/target/new-dir\", is_dir: true }\n// after\n{ path: \"new-dir\", is_dir: true }","handlingStrategy":"validation","validationCode":"-- Lua, before calling bulk_create\nlocal function is_relative(p)\n  return type(p) == \"string\" and p ~= \"\" and p:sub(1, 1) ~= \"/\"\nend\nassert(is_relative(entry.path), \"bulk_create requires paths relative to cwd\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip leading separators from user-provided paths before creating entries.","Treat entry.path as relative to the cwd by contract.","Validate all entries up front before invoking bulk_create."],"tags":["path","bulk-create","validation"],"backgroundTag":"invalid-path","analyzedSha":"5f901b886b14de1f17460b6e52e9de5d67f8aba9","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}