{"record":{"id":"76d8f0bc38f2df4a","repo":"tauri-apps/tauri","slug":"file-does-not-exist-at-path-path","errorCode":null,"errorMessage":"File does not exist at path: {path}","messagePattern":"File does not exist at path: (.+?)","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"crates/tauri/src/protocol/asset.rs","lineNumber":63,"sourceCode":"\n  if !scope.is_allowed(&path) {\n    log::error!(\"asset protocol not configured to allow the path: {path}\");\n    return resp.status(403).body(Vec::new().into()).map_err(Into::into);\n  }\n\n  // Separate block for easier error handling\n  let mut file = match File::open(path.clone()) {\n    Ok(file) => file,\n    Err(e) => {\n      #[cfg(target_os = \"android\")]\n      {\n        if path.starts_with(\"/storage/emulated/0/Android/data/\") {\n          log::error!(\"Failed to open Android external storage file '{path}': {e}. This may be due to missing storage permissions.\");\n        }\n      }\n      return if e.kind() == std::io::ErrorKind::NotFound {\n        log::error!(\"File does not exist at path: {path}\");\n        return resp.status(404).body(Vec::new().into()).map_err(Into::into);\n      } else if e.kind() == std::io::ErrorKind::PermissionDenied {\n        log::error!(\"Missing OS permission to access path \\\"{path}\\\": {e}\");\n        return resp.status(403).body(Vec::new().into()).map_err(Into::into);\n      } else {\n        Err(e.into())\n      };\n    }\n  };\n\n  let len = file.metadata()?.len();\n  let (mime_type, read_bytes) = {\n    // get file mime type\n    let nbytes = len.min(8192);\n    let mut magic_buf = Vec::with_capacity(nbytes as usize);\n    (&mut file).take(nbytes).read_to_end(&mut magic_buf)?;\n    file.rewind()?;\n    (\n      MimeType::parse(&magic_buf, &path),","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri/src/protocol/asset.rs#L45-L81","documentation":"Runtime 404 from the asset protocol handler. The path was valid and allowed by the asset scope, but File::open failed with std::io::ErrorKind::NotFound, so Tauri logs this message and returns an empty 404 body.","triggerScenarios":"Fetching convertFileSrc(path) for a file that has been deleted, not yet written, or spelled differently than on disk (wrong case on case-sensitive filesystems, wrong extension, trailing spaces).","commonSituations":"Referencing build artifacts or downloads that are produced asynchronously and not ready yet; moving/renaming files after the URL was built; developing case-insensitively on macOS and deploying to a case-sensitive Linux/Android filesystem; caching stale asset URLs.","solutions":["Check existence before fetching using the fs plugin: `import { exists } from '@tauri-apps/plugin-fs'; if (await exists(path)) ...`","Verify the exact filename (case, extension) matches what is on disk","Regenerate or re-download the expected file if the producer step was skipped or failed"],"exampleFix":"// before\nconst src = convertFileSrc(filePath);\nconst blob = await (await fetch(src)).blob(); // 404, empty body\n\n// after\nimport { exists } from '@tauri-apps/plugin-fs';\nif (!(await exists(filePath))) throw new Error(`missing asset: ${filePath}`);\nconst res = await fetch(convertFileSrc(filePath));\nif (!res.ok) throw new Error(`asset protocol ${res.status}`);","handlingStrategy":"validation","validationCode":"import { exists } from '@tauri-apps/plugin-fs';\nasync function assetOrPlaceholder(path, placeholder) {\n  return (await exists(path)) ? convertFileSrc(path) : placeholder;\n}","typeGuard":null,"tryCatchPattern":"const res = await fetch(convertFileSrc(filePath));\nif (res.status === 404) return fallbackAvatar; // graceful degradation\nif (!res.ok) throw new Error(`asset protocol error ${res.status}`);","preventionTips":["Check existence with the fs plugin before building asset URLs","Treat asset URLs as ephemeral: re-derive them from a current file listing instead of caching","Watch filename casing when developing on macOS but shipping to Linux/Android"],"tags":["asset-protocol","file-not-found","http-404","runtime","filesystem"],"backgroundTag":"file-not-found","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}