DioxusLabs/dioxus · error · NativeAssetResolveError
Asset not found
Error message
Asset not found
What it means
Terminal failure of resolve_native_asset: the requested asset path could not be located — the Android java loader had no match and resolve_asset_path_from_filesystem found no file, so the native asset server responds with this NativeAssetResolveError (surfaced as a failed/404 asset fetch for bundled resources).
Source
Thrown at packages/asset-resolver/src/native.rs:95
Ok(Response::builder()
.header("Content-Type", self.mime_type)
.header("Access-Control-Allow-Origin", "*")
.body(self.body)?)
}
}
/// Read the bytes for an asset
pub(crate) fn resolve_native_asset(path: &str) -> Result<Vec<u8>, NativeAssetResolveError> {
// Attempt to serve from the asset dir on android using its loader
#[cfg(target_os = "android")]
{
if let Some(asset) = to_java_load_asset(path) {
return Ok(asset);
}
}
let Some(uri_path) = resolve_asset_path_from_filesystem(path) else {
return Err(NativeAssetResolveError::IoError(std::io::Error::new(
std::io::ErrorKind::NotFound,
"Asset not found",
)));
};
Ok(std::fs::read(uri_path)?)
}
/// Resolve the asset and its mime type
fn resolve_asset(path: &str) -> Result<Option<ResolvedAsset>, NativeAssetResolveError> {
// Attempt to serve from the asset dir on android using its loader
#[cfg(target_os = "android")]
{
if let Some(asset) = to_java_load_asset(path) {
let extension = path.rsplit_once('.').and_then(|(_, ext)| Some(ext));
let mime_type = get_mime_from_ext(extension);
return Ok(Some(ResolvedAsset::new(mime_type, asset)));
}
}View on GitHub (pinned to 24f6a829df)
Solutions
- The asset was not found. Check the asset path and ensure it was bundled via the asset!() macro with dx as the linker.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/asset-resolver/src/native.rs:95 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23).
Data as JSON: /api/errors/5d2c65e201911baf.
Report an issue: GitHub.