{"record":{"id":"64d85b615faeca75","repo":"tauri-apps/tauri","slug":"unable-to-find-isolation-file","errorCode":null,"errorMessage":"unable to find isolation file","messagePattern":"unable to find isolation file","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-utils/src/html.rs","lineNumber":276,"sourceCode":"    .expect(\"unable to parse document for scripts\")\n  {\n    let src = {\n      let attributes = script.attributes.borrow();\n      attributes\n        .get(LocalName::from(\"src\"))\n        .expect(\"script with src attribute has no src value\")\n        .to_string()\n    };\n\n    let mut path = PathBuf::from(src);\n    if path.has_root() {\n      path = path\n        .strip_prefix(\"/\")\n        .expect(\"Tauri \\\"Isolation\\\" Pattern only supports relative or absolute (`/`) paths.\")\n        .into();\n    }\n\n    let file = std::fs::read_to_string(dir.join(path)).expect(\"unable to find isolation file\");\n    script.as_node().append(NodeRef::new_text(file));\n\n    let mut attributes = script.attributes.borrow_mut();\n    attributes.remove(LocalName::from(\"src\"));\n  }\n}\n\n// TODO: Verify this, this is not found in the HTML spec, see https://github.com/tauri-apps/tauri/pull/14265#discussion_r2415396842\n/// Normalize line endings in script content to match what the browser uses for CSP hashing.\n///\n/// According to the HTML spec, browsers normalize:\n/// - `\\r\\n` → `\\n`\n/// - `\\r`   → `\\n`\npub fn normalize_script_for_csp(input: &[u8]) -> Vec<u8> {\n  let mut output = Vec::with_capacity(input.len());\n\n  let mut i = 0;\n  while i < input.len() {","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-utils/src/html.rs#L258-L294","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"<!-- before: file lives in dist/isolation/index.js -->\n<script src=\"../../src/isolation/index.js\"></script>\n\n<!-- after -->\n<script src=\"isolation/index.js\"></script>","handlingStrategy":"validation","validationCode":"// pre-flight before tauri dev/build: every src must exist under dist\nlet dist = std::path::Path::new(\"../path/to/dist\");\nfor src in collect_script_srcs(\"isolation/index.html\") {\n    let p = dist.join(src.trim_start_matches('/'));\n    assert!(p.is_file(), \"isolation script missing: {}\", p.display());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["tauri","isolation-pattern","file-not-found","html"],"backgroundTag":"file-not-found","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","contentChangedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}