tauri-apps/tauri · error
unable to parse document for scripts
Error message
unable to parse document for scripts
What it means
`inline_isolation` walks the parsed HTML document and calls `document.select("script[src]")` to find external scripts. `select` only errors for an invalid CSS selector; since the selector is a constant valid string, this panic indicates an internal invariant break in the html parsing setup.
Solutions
- Rebuild with aligned dependency versions (`cargo update`, then `cargo clean`).
- Check that you are not overriding the `scraper` dependency version in Cargo.toml.
- Report to Tauri if it reproduces on stock versions.
Defensive patterns
Strategy: fallback
Try / catch
// defensively wrap document processing
if std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
tauri::utils::html::inline_isolation(&document, &dir);
})).is_err() { eprintln!("isolation inlining failed"); } Prevention
- Use stock, unpatched tauri-utils with its matching scraper dependency.
- Do not hand-edit html.rs selector logic.
- Pin dependency versions in Cargo.lock for reproducible builds.
When it happens
Trigger: Practically unreachable from user input — triggered only if the scraper/html5ever `select` API rejects the built-in selector, i.e. a library bug or incompatible scraper version.
Common situations: Dependency version drift where `tauri-utils` is compiled against an incompatible `scraper` API; custom forks patching html.rs.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Tauri "Isolation" Pattern only supports relative or…
- unable to find isolation file
- No file found in matching
- unable to render codegen isolation script template
- unable to render codegen isolation script template
AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18).
Data as JSON: /api/errors/f0646de61e3cfe94.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tauri-utils/src/html.rs:258
script.append(NodeRef::new_text(
IsolationJavascriptCodegen {}
.render_default(&Default::default())
.expect("unable to render codegen isolation script template")
.into_string(),
));
head.prepend(script);
});
}
/// Temporary workaround for Windows not allowing requests
///
/// Note: this does not prevent path traversal due to the isolation application expectation that it
/// is secure.
pub fn inline_isolation(document: &NodeRef, dir: &Path) {
for script in document
.select("script[src]")
.expect("unable to parse document for scripts")
{
let src = {
let attributes = script.attributes.borrow();
attributes
.get(LocalName::from("src"))
.expect("script with src attribute has no src value")
.to_string()
};
let mut path = PathBuf::from(src);
if path.has_root() {
path = path
.strip_prefix("/")
.expect("Tauri \"Isolation\" Pattern only supports relative or absolute (`/`) paths.")
.into();
}
let file = std::fs::read_to_string(dir.join(path)).expect("unable to find isolation file");View on GitHub (pinned to 460ec35447)