{"record":{"id":"cb46101b523313c0","repo":"tauri-apps/tauri","slug":"the-isolation-application-does-not-contain-a-file","errorCode":null,"errorMessage":"The isolation application does not contain a file setting the `window.__TAURI_ISOLATION_HOOK__` value.","messagePattern":"The isolation application does not contain a file setting the `window\\.__TAURI_ISOLATION_HOOK__` value\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-codegen/src/context.rs","lineNumber":379,"sourceCode":"      if !dir.exists() {\n        panic!(\"The isolation application path is set to `{dir:?}` but it does not exist\")\n      }\n\n      let mut sets_isolation_hook = false;\n\n      let key = uuid::Uuid::new_v4().to_string();\n      let map_isolation = map_isolation(&options, dir.clone());\n      let assets = EmbeddedAssets::new(dir, &options, |key, path, input, csp_hashes| {\n        // we check if `__TAURI_ISOLATION_HOOK__` exists in the isolation code\n        // before modifying the files since we inject our own `__TAURI_ISOLATION_HOOK__` reference in HTML files\n        if String::from_utf8_lossy(input).contains(\"__TAURI_ISOLATION_HOOK__\") {\n          sets_isolation_hook = true;\n        }\n        map_isolation(key, path, input, csp_hashes)\n      })?;\n\n      if !sets_isolation_hook {\n        panic!(\n          \"The isolation application does not contain a file setting the `window.__TAURI_ISOLATION_HOOK__` value.\"\n        );\n      }\n\n      let schema = options.isolation_schema;\n\n      quote!(#root::Pattern::Isolation {\n        assets: ::std::sync::Arc::new(#assets),\n        schema: #schema.into(),\n        key: #key.into(),\n        crypto_keys: std::boxed::Box::new(::tauri::utils::pattern::isolation::Keys::new().expect(\"unable to generate cryptographically secure keys for Tauri \\\"Isolation\\\" Pattern\")),\n      })\n    }\n  };\n\n  let acl_file_path = out_dir.join(ACL_MANIFESTS_FILE_NAME);\n  let acl: BTreeMap<String, Manifest> = if acl_file_path.exists() {\n    let acl_file =","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-codegen/src/context.rs#L361-L397","documentation":"When using Tauri's isolation pattern, every file of the isolation application is processed at compile time and at least one must set `window.__TAURI_ISOLATION_HOOK__`. If none of the bundled files do, the codegen panics because the isolation layer would not be able to proxy messages safely.","triggerScenarios":"Building with PatternKind::Isolation where the isolation dir contains an app (HTML/JS) that never assigns window.__TAURI_ISOLATION_HOOK__ — e.g. the hook script was removed, minified away, or the wrong dist folder was configured.","commonSituations":"Writing a custom isolation app and forgetting the hook assignment; a bundler (Terser, Rollup) tree-shaking or renaming the hook; pointing at the wrong build output directory; using an outdated isolation template.","solutions":["Add `window.__TAURI_ISOLATION_HOOK__ = (payload) => ...` in a script loaded by the isolation app's entry HTML","Ensure the bundler does not strip/rename the assignment (e.g. exclude from minification)","Point the isolation `dir` in tauri.conf.json at the folder that actually contains the hook script","Rebuild the isolation app into the configured directory before running tauri build/dev"],"exampleFix":"// before (isolation init script)\nconsole.log('isolation ready');\n// after\nwindow.__TAURI_ISOLATION_HOOK__ = (payload) => {\n  // validate/forward message\n  return payload;\n};","handlingStrategy":"validation","validationCode":"const fs = require('fs'), path = require('path');\nfunction hasHook(dir) {\n  return fs.readdirSync(dir, { recursive: true }).some(f =>\n    /\\.(js|html)$/.test(f) && fs.readFileSync(path.join(dir, f), 'utf8').includes('__TAURI_ISOLATION_HOOK__'));\n}\nif (!hasHook('isolation/dist')) throw new Error('isolation hook missing');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the hook assignment in a dedicated, non-minified script file","Add a CI grep for __TAURI_ISOLATION_HOOK__ in the isolation dist output","Configure the bundler to preserve the hook (mangle:false for that identifier)","Regenerate the dist from the isolation template after changes"],"tags":["isolation","codegen","javascript","missing-symbol"],"backgroundTag":"missing-required-config","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"}