{"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!(\"The isolation application does not contain a file setting the `window.__TAURI_ISOLATION_HOOK__` value.\");\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 =\n      std::fs::read_to_string(acl_file_path).expect(\"failed to read plugin manifest map\");\n    serde_json::from_str(&acl_file).expect(\"failed to parse plugin manifest map\")","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-codegen/src/context.rs#L361-L397","documentation":"Compile-time panic in tauri-codegen for the Isolation pattern. While embedding the isolation directory it scans every file's contents for the literal string __TAURI_ISOLATION_HOOK__ (checked before the files are processed, since Tauri injects its own reference into HTML); if no file sets window.__TAURI_ISOLATION_HOOK__, generation aborts because the pattern cannot function without the hook.","triggerScenarios":"An isolation frontend whose index.html/scripts never assign window.__TAURI_ISOLATION_HOOK__; a build step that strips or renames the identifier (aggressive minification of the literal is unusual, but deleting the hook line is common); starting from an empty scaffold.","commonSituations":"Copying a plain static page as the isolation app; removing the hook boilerplate thinking it was debug code; hook placed in a file outside the configured isolation dir.","solutions":["Add `<script>window.__TAURI_ISOLATION_HOOK__ = (payload) => { /* forward to main world */ };</script>` to the isolation app's index.html","Make sure the file containing the hook lives inside the configured isolation dir","Verify with a grep before building: `grep -r __TAURI_ISOLATION_HOOK__ <isolation-dir>` must match"],"exampleFix":"<!-- before: isolation/index.html has no hook -> panic -->\n<!doctype html><html><body><h1>Isolated</h1></body></html>\n\n<!-- after -->\n<!doctype html><html><body><h1>Isolated</h1>\n<script>window.__TAURI_ISOLATION_HOOK__ = (payload) => { console.log('hook', payload); };</script>\n</body></html>","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\ndir=$(jq -r '.app.security.pattern.isolation.dir' src-tauri/tauri.conf.json)\ngrep -rq '__TAURI_ISOLATION_HOOK__' \"src-tauri/$dir\" || { echo 'isolation app never sets __TAURI_ISOLATION_HOOK__'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Scaffold isolation apps from the official template so the hook boilerplate is present","Add the grep check to CI right after the directory-exists check","Keep the hook assignment in index.html, not in files outside the isolation dir"],"tags":["isolation-pattern","tauri-codegen","codegen","security","csp"],"backgroundTag":"isolation-hook-missing","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}