{"record":{"id":"5746f70cacce2fcd","repo":"DioxusLabs/dioxus","slug":"expected-url-to-be-utf-8-encoded","errorCode":null,"errorMessage":"expected URL to be UTF-8 encoded","messagePattern":"expected URL to be UTF-8 encoded","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/asset-resolver/src/native.rs","lineNumber":46,"sourceCode":"            // If the asset exists in the Android asset manager, return the can't be represented as a path\n            // error instead\n            if to_java_load_asset(path).is_some() {\n                return AssetPathError::CannotRepresentAsPath;\n            }\n        }\n\n        AssetPathError::NotFound\n    })\n}\n\n/// Try to resolve the path of an asset from a given URI path.\nfn resolve_asset_path_from_filesystem(path: &str) -> Option<PathBuf> {\n    // If the user provided a custom asset handler, then call it and return the response if the request was handled.\n    // The path is the first part of the URI, so we need to trim the leading slash.\n    let mut uri_path = PathBuf::from(\n        percent_encoding::percent_decode_str(path)\n            .decode_utf8()\n            .expect(\"expected URL to be UTF-8 encoded\")\n            .as_ref(),\n    );\n\n    // If the asset doesn't exist, or starts with `/assets/`, then we'll try to serve out of the bundle\n    // This lets us handle both absolute and relative paths without being too \"special\"\n    // It just means that our macos bundle is a little \"special\" because we need to place an `assets`\n    // dir in the `Resources` dir.\n    //\n    // If there's no asset root, we use the cargo manifest dir as the root, or the current dir\n    if !uri_path.exists() || uri_path.starts_with(\"/assets/\") {\n        let bundle_root = get_asset_root();\n        let relative_path = uri_path.strip_prefix(\"/\").unwrap();\n        uri_path = bundle_root.join(relative_path);\n    }\n\n    // If the asset exists, return it\n    uri_path.exists().then_some(uri_path)\n}","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/asset-resolver/src/native.rs#L28-L64","documentation":"The native asset resolver was given a request URL whose bytes are not valid UTF-8, so it cannot be converted to a &str for filesystem or asset-manager lookup. This indicates a malformed or binary-garbage request path.","triggerScenarios":"Thrown at packages/asset-resolver/src/native.rs:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the asset URL/path is valid UTF-8; rename the asset or fix the path if it contains non-UTF-8 bytes."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}