{"record":{"id":"9413d15e9a1fa743","repo":"sxyazi/yazi","slug":"invalid-path","errorCode":null,"errorMessage":"Invalid path","messagePattern":"Invalid path","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","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(), \"{EraseScreen}\\n\")?;\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/94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2/yazi-actor/src/mgr/bulk_create.rs#L56-L92","documentation":"During bulk file creation each edited entry is joined onto the working directory with cwd.try_join(entry.path). If the join fails — the entry cannot be represented as a valid relative path under cwd for that URL kind — the entry is skipped from creation and pushed onto the failed list, which is printed at the end of the run. The operation as a whole continues; only that entry is lost.","triggerScenarios":"A bulk_create buffer entry that is an absolute path, a path escaping cwd, contains bytes invalid for the URL kind's strand (NUL, invalid UTF-8), or mismatches the URL kind (local path under an archive/remote URL). cwd.try_join returns Err and the entry lands in failed.","commonSituations":"Editing the bulk-create buffer with an editor that absolutizes paths or inserts control characters; mixing entries across URL kinds; scripts generating the buffer with stray bytes.","solutions":["Fix the flagged entries: keep each path relative to cwd and valid for that URL kind, then re-run","Run bulk_create from the directory the paths are actually relative to","Read the failed-pairs output after the run — it names exactly which entries were invalid"],"exampleFix":"// before (buffer line, absolute path)\n/tmp/notes/todo.txt\n\n// after (relative to cwd)\nnotes/todo.txt","handlingStrategy":"validation","validationCode":"// Validate every entry before running bulk_create:\nfor entry in &todo {\n    if cwd.try_join(entry.path).is_err() {\n        return Err(anyhow!(\"entry `{}` is not a valid path under {}\", entry.path, cwd));\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep bulk-create entries relative to the current directory","Do not mix local-style paths into archive/remote URL buffers","Review the failed list printed after every bulk run"],"tags":["bulk-create","paths","vfs","strand"],"backgroundTag":null,"analyzedSha":"94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2","analyzedAt":"2026-08-16T09:56:24.836Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}