tauri-apps/tauri · error
The isolation application does not contain a file setting…
Error message
The isolation application does not contain a file setting the `window.__TAURI_ISOLATION_HOOK__` value.
What it means
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.
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
Example fix
// before (isolation init script)
console.log('isolation ready');
// after
window.__TAURI_ISOLATION_HOOK__ = (payload) => {
// validate/forward message
return payload;
}; Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs'), path = require('path');
function hasHook(dir) {
return fs.readdirSync(dir, { recursive: true }).some(f =>
/\.(js|html)$/.test(f) && fs.readFileSync(path.join(dir, f), 'utf8').includes('__TAURI_ISOLATION_HOOK__'));
}
if (!hasHook('isolation/dist')) throw new Error('isolation hook missing'); Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- failed to serialize plist
- The isolation application path is set to
- failed to decode icon
- failed to open icon
- failed to parse icon
AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18).
Data as JSON: /api/errors/cb46101b523313c0.
Report an issue: GitHub.
Appendix: 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 =View on GitHub (pinned to 460ec35447)