{"record":{"id":"f5af3fc4364469d3","repo":"sxyazi/yazi","slug":"not-a-local-url-url","errorCode":null,"errorMessage":"Not a local URL: {url}","messagePattern":"Not a local URL: (.+?)","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"yazi-fs/src/engine/local/demand.rs","lineNumber":44,"sourceCode":"\tfn create(&mut self, create: bool) -> &mut Self {\n\t\tself.0.create(create);\n\t\tself\n\t}\n\n\tfn create_new(&mut self, create_new: bool) -> &mut Self {\n\t\tself.0.create_new(create_new);\n\t\tself\n\t}\n\n\tasync fn open<U>(&self, url: U) -> io::Result<Self::File>\n\twhere\n\t\tU: AsUrl,\n\t{\n\t\tlet url = url.as_url();\n\t\tif let Some(path) = url.as_local() {\n\t\t\tself.0.open(path).await\n\t\t} else {\n\t\t\tErr(io::Error::new(io::ErrorKind::InvalidInput, format!(\"Not a local URL: {url}\")))\n\t\t}\n\t}\n\n\tfn read(&mut self, read: bool) -> &mut Self {\n\t\tself.0.read(read);\n\t\tself\n\t}\n\n\tfn truncate(&mut self, truncate: bool) -> &mut Self {\n\t\tself.0.truncate(truncate);\n\t\tself\n\t}\n\n\tfn write(&mut self, write: bool) -> &mut Self {\n\t\tself.0.write(write);\n\t\tself\n\t}\n}","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/sxyazi/yazi/blob/8ebf930f1796ae2076b7d6b0c5e93a1002c18134/yazi-fs/src/engine/local/demand.rs#L26-L62","documentation":"Local file operations in yazi-fs's local engine require a URL that resolves to a local filesystem path (`url.as_local()`). When given a remote (Sftp/other-scheme) or non-local URL, `open` returns an InvalidInput io::Error naming the URL. This is a guard against using the local file engine for non-local locations.","triggerScenarios":"Calling the local file open API (File::open via LocalFs demand) with a Url that is not a local scheme, e.g. a Unix-with-auth (SFTP) URL.","commonSituations":"Plugin/task code holding a URL from a remote tab and passing it to a local-file API; forgetting to route remote URLs through the VFS/SFTP engine; mixing Mgr entries from different scheme tabs.","solutions":["Check `url.as_local().is_some()` (or the URL scheme) before opening and route remote URLs to the appropriate VFS engine instead.","If the file should be local, correct its construction so the URL has no remote auth component.","For remote reads, use the SFTP engine (yazi-vfs) or download to a local temporary path first."],"exampleFix":"// before\nLocalFile::open(url).await?; // may be remote\n// after\nif let Some(path) = url.as_local() {\n    LocalFile::open(path).await?;\n} else {\n    Vfs::open(url).await?;\n}","handlingStrategy":"type-guard","validationCode":"if url.as_local().is_none() { /* route to Vfs/Sftp engine instead */ }","typeGuard":"fn local_path(url: &Url) -> Option<&Path> { url.as_local() }","tryCatchPattern":"// io::Error with InvalidInput kind\nmatch LocalFile::open(url).await {\n    Err(e) if e.kind() == io::ErrorKind::InvalidInput => route_to_vfs(url).await,\n    other => other?,\n}","preventionTips":["Check `url.as_local().is_some()` before any local-file API call.","Route URLs by scheme: local to yazi-fs, remote to yazi-vfs.","Don't reuse entry URLs across tabs with different schemes without re-checking locality."],"tags":["io","url","filesystem","rust"],"backgroundTag":"invalid-url","analyzedSha":"8ebf930f1796ae2076b7d6b0c5e93a1002c18134","analyzedAt":"2026-09-09T22:26:16.379Z","contentChangedAt":"2026-09-09T22:26:16.379Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}