tauri-apps/tauri · error
The isolation application does not contain a file setting th
Error message
The isolation application does not contain a file setting the `window.__TAURI_ISOLATION_HOOK__` value.
What it means
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.
Source
Thrown at crates/tauri-codegen/src/context.rs:379
if !dir.exists() {
panic!("The isolation application path is set to `{dir:?}` but it does not exist")
}
let mut sets_isolation_hook = false;
let key = uuid::Uuid::new_v4().to_string();
let map_isolation = map_isolation(&options, dir.clone());
let assets = EmbeddedAssets::new(dir, &options, |key, path, input, csp_hashes| {
// we check if `__TAURI_ISOLATION_HOOK__` exists in the isolation code
// before modifying the files since we inject our own `__TAURI_ISOLATION_HOOK__` reference in HTML files
if String::from_utf8_lossy(input).contains("__TAURI_ISOLATION_HOOK__") {
sets_isolation_hook = true;
}
map_isolation(key, path, input, csp_hashes)
})?;
if !sets_isolation_hook {
panic!("The isolation application does not contain a file setting the `window.__TAURI_ISOLATION_HOOK__` value.");
}
let schema = options.isolation_schema;
quote!(#root::Pattern::Isolation {
assets: ::std::sync::Arc::new(#assets),
schema: #schema.into(),
key: #key.into(),
crypto_keys: std::boxed::Box::new(::tauri::utils::pattern::isolation::Keys::new().expect("unable to generate cryptographically secure keys for Tauri \"Isolation\" Pattern")),
})
}
};
let acl_file_path = out_dir.join(ACL_MANIFESTS_FILE_NAME);
let acl: BTreeMap<String, Manifest> = if acl_file_path.exists() {
let acl_file =
std::fs::read_to_string(acl_file_path).expect("failed to read plugin manifest map");
serde_json::from_str(&acl_file).expect("failed to parse plugin manifest map")View on GitHub (pinned to 52e4b6e71d)
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
Example fix
<!-- before: isolation/index.html has no hook -> panic -->
<!doctype html><html><body><h1>Isolated</h1></body></html>
<!-- after -->
<!doctype html><html><body><h1>Isolated</h1>
<script>window.__TAURI_ISOLATION_HOOK__ = (payload) => { console.log('hook', payload); };</script>
</body></html> Defensive patterns
Strategy: validation
Validate before calling
#!/usr/bin/env bash
dir=$(jq -r '.app.security.pattern.isolation.dir' src-tauri/tauri.conf.json)
grep -rq '__TAURI_ISOLATION_HOOK__' "src-tauri/$dir" || { echo 'isolation app never sets __TAURI_ISOLATION_HOOK__'; exit 1; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- The isolation application path is set to `{dir:?}` but it do
- The `frontendDist` configuration is set to `{path:?}` but th
- failed to read plist {}: {}
- failed to parse icon {}: {}
- failed to decode icon {}: {}
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/cb46101b523313c0.
Report an issue: GitHub.