leptos-rs/leptos · error
could not read manifest file
Error message
could not read manifest file
What it means
When HydrationScripts finds __wasm_split_manifest.json in the package directory, it parses it with serde_json and expects success. The panic means the manifest file exists but is not valid JSON matching the expected WasmSplitManifest shape (or serde failed reading its contents).
Solutions
- Rebuild with cargo leptos build (clean the target/site directory first) to regenerate a valid manifest.
- Verify __wasm_split_manifest.json parses as the expected JSON (object with the wasm-split entries) with jq.
- Align leptos and wasm-split tool versions across all crates in the workspace.
- Purge stale CI caches of target/site so an old manifest isn't reused.
Example fix
// before rm target/site/pkg/__wasm_split_manifest.json # stale schema // after cargo clean -p app && cargo leptos build # regenerates valid manifest
Defensive patterns
Strategy: validation
Validate before calling
let raw = std::fs::read_to_string("target/site/pkg/__wasm_split_manifest.json")?;
let v: serde_json::Value = serde_json::from_str(&raw)?; // fails fast if corrupt
Type guard
fn valid_manifest(s: &str) -> bool {
serde_json::from_str::<serde_json::Value>(s).map(|v| v.is_object()).unwrap_or(false)
}
Prevention
- Clean target/site before release builds to avoid stale manifests
- Pin leptos and wasm-split tool versions across the workspace
- Validate the manifest JSON in CI after each build
- Avoid caching target/site/pkg across different tool versions
When it happens
Trigger: A corrupted, truncated, or hand-edited __wasm_split_manifest.json in the target/site pkg dir; a manifest produced by an incompatible wasm-split version that changed the JSON schema.
Common situations: Partial/stale build artifacts from an interrupted cargo leptos build; mixing leptos/wasm-split versions across a workspace; CI caching a pkg dir from a different build; manually editing output hashes in the manifest.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- could not deserialize props
- failed to read hash file
- lazy routes should not be used with hydrate_body(); use…
- missing element
- there to be a element
AI-assisted analysis of leptos-rs/leptos@32d20f6c9d (2026-09-01).
Data as JSON: /api/errors/651f6ac6f1de314b.
Report an issue: GitHub.
Appendix: source
Thrown at leptos/src/hydration/mod.rs:113
}
}
(split, manifest)
} else {
(
"__wasm_split.______________________.js".to_string(),
"__wasm_split_manifest.json".to_string(),
)
};
let site_dir = &options.site_root;
let pkg_dir = &options.site_pkg_dir;
let path = PathBuf::from(site_dir.to_string());
let path = path.join(pkg_dir.to_string()).join(wasm_split_manifest);
let file = std::fs::read_to_string(path).ok()?;
let manifest = WasmSplitManifest(ArcStoredValue::new((
format!("{root}/{pkg_dir}"),
serde_json::from_str(&file).expect("could not read manifest file"),
wasm_split_js,
)));
Some(manifest)
}) {
provide_context(splits.clone());
}
let mut js_file_name = options.output_name.to_string();
let mut wasm_file_name = options.output_name.to_string();
if options.hash_files {
let hash_path = std::env::current_exe()
.map(|path| {
path.parent().map(|p| p.to_path_buf()).unwrap_or_default()
})
.unwrap_or_default()
.join(options.hash_file.as_ref());
if hash_path.exists() {View on GitHub (pinned to 32d20f6c9d)