tauri-apps/tauri · error
unable to find isolation file
Error message
unable to find isolation file
What it means
After stripping the leading `/`, `inline_isolation` reads the isolation script from `dir.join(path)` with `fs::read_to_string` and panics with this message if the file cannot be read — either it does not exist or it is unreadable. The library expects the isolation pattern's script file (e.g. `dist-isolation/index.js`) to be present at codegen time.
Solutions
- Build the isolation frontend first so the script file exists at the configured path (e.g. `pnpm build` in the isolation package)
- Verify the isolation directory configured in tauri.conf.json actually contains the referenced script file
- Check filename casing matches exactly (case-sensitive filesystems)
- Ensure the file is readable and UTF-8 encoded
Example fix
// before tauri build // after pnpm --filter isolation-app build && tauri build
Defensive patterns
Strategy: validation
Validate before calling
let resolved = isolation_dir.join(&script_rel_path);
assert!(resolved.is_file(), "isolation script missing: {}", resolved.display()); Prevention
- Build the isolation frontend before `tauri build`/`tauri dev`
- Verify the isolation directory contains the referenced script after every build
- Check filename casing on case-sensitive filesystems/CI
When it happens
Trigger: Running `tauri build`/`tauri dev` when the HTML being processed references an isolation script whose resolved path under the isolation dir does not exist or is not valid UTF-8; misconfigured `withGlobalTauri`/isolation `pattern` pointing at a directory without the script.
Common situations: Forgetting to build the isolation frontend before running tauri; wrong `frontendDist`/isolation directory in tauri.conf.json; renamed or deleted `index.js` in the isolation output; case-sensitivity mismatches on Linux CI.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- failed to canonicalize global API script path
- failed to get exe directory
- failed to read capabilities
- failed to read plugin global API script paths
- failed to read plugin manifest map
AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18).
Data as JSON: /api/errors/5b9db6aa5440ebe8.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tauri-utils/src/html2.rs:156
#[cfg(feature = "isolation")]
pub fn inline_isolation(document: &Document, dir: &std::path::Path) {
let scripts = document.select("script[src]");
for script in scripts.nodes() {
let src = match script.attr("src") {
Some(s) => s.to_string(),
None => continue,
};
let mut path = std::path::PathBuf::from(src);
if path.has_root() {
path = path
.strip_prefix("/")
.expect("Tauri \"Isolation\" Pattern only supports relative or absolute (`/`) paths.")
.into();
}
let file = std::fs::read_to_string(dir.join(path)).expect("unable to find isolation file");
script.set_text(file);
script.remove_attr("src");
}
}
// TODO: Verify this, this is not found in the HTML spec, see https://github.com/tauri-apps/tauri/pull/14265#discussion_r2415396842
/// Normalize line endings in script content to match what the browser uses for CSP hashing.
///
/// According to the HTML spec, browsers normalize:
/// - `\r\n` → `\n`
/// - `\r` → `\n`
pub fn normalize_script_for_csp(input: &[u8]) -> Vec<u8> {
let mut output = Vec::with_capacity(input.len());
let mut i = 0;
while i < input.len() {
match input[i] {View on GitHub (pinned to 460ec35447)