tauri-apps/tauri · error
unable to find isolation file
Error message
unable to find isolation file
What it means
Part of Isolation Pattern processing: after resolving each script's src against the app's dist directory, Tauri reads the referenced file and inlines its contents into the HTML. The expect fires when std::fs::read_to_string(dir.join(path)) errors: the file does not exist at the joined path, a parent directory is missing, permission is denied, or the file is not valid UTF-8.
Source
Thrown at crates/tauri-utils/src/html.rs:276
.expect("unable to parse document for scripts")
{
let src = {
let attributes = script.attributes.borrow();
attributes
.get(LocalName::from("src"))
.expect("script with src attribute has no src value")
.to_string()
};
let mut 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.as_node().append(NodeRef::new_text(file));
let mut attributes = script.attributes.borrow_mut();
attributes.remove(LocalName::from("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() {View on GitHub (pinned to 52e4b6e71d)
Solutions
- Verify the file exists at <frontendDist>/<src> exactly as referenced (mind ../ segments, resolved literally against the dist dir).
- Fix the src to point at a file the frontend build actually emits into dist.
- If the script is generated, run the generator before tauri dev / tauri build processes the HTML.
- Check that tauri.conf.json app.frontendDist matches the folder containing the script.
Example fix
<!-- before: file lives in dist/isolation/index.js --> <script src="../../src/isolation/index.js"></script> <!-- after --> <script src="isolation/index.js"></script>
Defensive patterns
Strategy: validation
Validate before calling
// pre-flight before tauri dev/build: every src must exist under dist
let dist = std::path::Path::new("../path/to/dist");
for src in collect_script_srcs("isolation/index.html") {
let p = dist.join(src.trim_start_matches('/'));
assert!(p.is_file(), "isolation script missing: {}", p.display());
} Prevention
- Ensure the frontend build emits every referenced isolation script into dist.
- Keep frontendDist in tauri.conf.json in sync with script paths.
- Run the pre-flight check in CI so failures surface before the panic.
When it happens
Trigger: A script src in the isolation index.html pointing at a file that is not inside the frontend dist directory when Tauri processes it: wrong ../ levels, typo, file not emitted by the frontend build, or tauri.conf.json frontendDist pointing at a different folder.
Common situations: Bundler config that skips copying the isolation script into dist; referencing a file in src/ or node_modules/ that never lands in dist; changing the dist directory without updating script paths.
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
- unable to find isolation file
- Tauri "Isolation" Pattern only supports relative or absolute
- Tauri "Isolation" Pattern only supports relative or absolute
- File does not exist at path: {path}
- The isolation application path is set to `{dir:?}` but it do
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/64d85b615faeca75.
Report an issue: GitHub.