{"record":{"id":"5b9db6aa5440ebe8","repo":"tauri-apps/tauri","slug":"unable-to-find-isolation-file-5b9db6","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/html2.rs","lineNumber":156,"sourceCode":"#[cfg(feature = \"isolation\")]\npub fn inline_isolation(document: &Document, dir: &std::path::Path) {\n  let scripts = document.select(\"script[src]\");\n\n  for script in scripts.nodes() {\n    let src = match script.attr(\"src\") {\n      Some(s) => s.to_string(),\n      None => continue,\n    };\n\n    let mut path = std::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\n    script.set_text(file);\n    script.remove_attr(\"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() {\n    match input[i] {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-utils/src/html2.rs#L138-L174","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ntauri build\n// after\npnpm --filter isolation-app build && tauri build","handlingStrategy":"validation","validationCode":"let resolved = isolation_dir.join(&script_rel_path);\nassert!(resolved.is_file(), \"isolation script missing: {}\", resolved.display());","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["file-not-found","build-time","panic","filesystem","tauri"],"backgroundTag":"file-not-found","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}