{"record":{"id":"2a89557c32afffb3","repo":"tauri-apps/tauri","slug":"invalid-webview-url","errorCode":null,"errorMessage":"invalid webview URL","messagePattern":"invalid webview URL","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-runtime-wry/src/lib.rs","lineNumber":3795,"sourceCode":"          }\n          WebviewMessage::SetBackgroundColor(color) => {\n            if let Err(e) =\n              webview.set_background_color(color.map(Into::into).unwrap_or((255, 255, 255, 255)))\n            {\n              log::error!(\"failed to set webview background color: {e}\");\n            }\n          }\n          WebviewMessage::ClearAllBrowsingData => {\n            if let Err(e) = webview.clear_all_browsing_data() {\n              log::error!(\"failed to clear webview browsing data: {e}\");\n            }\n          }\n          // Getters\n          WebviewMessage::Url(tx) => {\n            tx.send(\n              webview\n                .url()\n                .map(|u| u.parse().expect(\"invalid webview URL\"))\n                .map_err(|_| Error::FailedToSendMessage),\n            )\n            .unwrap();\n          }\n\n          WebviewMessage::Cookies(tx) => {\n            tx.send(webview.cookies().map_err(|_| Error::FailedToSendMessage))\n              .unwrap();\n          }\n\n          WebviewMessage::SetCookie(cookie) => {\n            if let Err(e) = webview.set_cookie(&cookie) {\n              log::error!(\"failed to set webview cookie: {e}\");\n            }\n          }\n\n          WebviewMessage::DeleteCookie(cookie) => {\n            if let Err(e) = webview.delete_cookie(&cookie) {","sourceCodeStart":3777,"sourceCodeEnd":3813,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-runtime-wry/src/lib.rs#L3777-L3813","documentation":"While servicing a `WebviewMessage::Url` request (used by APIs that read the current webview URL), the runtime calls `webview.url()` and parses the returned string into a `Url`. If the parse fails, `expect` panics with this message instead of returning the `FailedToSendMessage` error.","triggerScenarios":"Calling URL-reading APIs (`webview.url()`, getters that send `WebviewMessage::Url`) while the webview reports a URL string that is not a valid absolute URL — e.g. about:blank-like empty locations, non-standard scheme responses, or a webview that has not completed its initial navigation.","commonSituations":"Polling `webview.url()` immediately after creation before navigation finishes; pages loaded via unusual custom protocols; platform quirks returning a bare string without scheme.","solutions":["Wait for the page load event (e.g. `on_page_load` / navigation completion) before reading the URL.","Ensure the webview was created with a valid absolute URL (with scheme).","If reproducible, file a Tauri issue — the runtime should degrade to an error, not panic."],"exampleFix":"// before\nlet url = webview.url().unwrap();\n\n// after\nwebview.on_page_load(|_, _| {\n  let url = webview.url();\n});","handlingStrategy":"validation","validationCode":"// validate before reading\nlet raw = webview.url().map_err(|_| ...)?;\nif url::Url::parse(&raw).is_err() { /* defer until page loaded */ }","typeGuard":"fn is_valid_url(s: &str) -> bool { url::Url::parse(s).is_ok() }","tryCatchPattern":"// if wrapping the runtime call\nlet result = std::panic::catch_unwind(|| webview.url());","preventionTips":["Create webviews only with absolute URLs that include a scheme.","Read the URL only after the page-load event fires.","Poll defensively with a delay/retry instead of reading immediately after creation."],"tags":["webview","url","panic","runtime"],"backgroundTag":"invalid-url-format","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}