{"record":{"id":"ee5a751746b02bae","repo":"DioxusLabs/dioxus","slug":"bad-request-invalid-webview-id","errorCode":null,"errorMessage":"Bad Request: Invalid webview ID","messagePattern":"Bad Request: Invalid webview ID","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"packages/desktop/src/edits.rs","lineNumber":304,"sourceCode":"\n        let current_server_location = { *server_location.lock().unwrap() };\n        let hex_encoded_client_key = encode_key_string(&current_server_location.client_key);\n        let hex_encoded_server_key = encode_key_string(&current_server_location.server_key);\n        let mut location = None;\n\n        #[allow(clippy::result_large_err)]\n        let on_request = |req: &Request, res| {\n            // Try to parse the webview id and key from the path\n            let path = req.uri().path();\n\n            // The path should have two parts `/webview_id/key`\n            let mut segments = path.trim_matches('/').split('/');\n            let webview_id = segments\n                .next()\n                .and_then(|s| s.parse::<u32>().ok())\n                .ok_or_else(|| {\n                    Response::builder()\n                        .status(400)\n                        .body(Some(\"Bad Request: Invalid webview ID\".to_string()))\n                        .unwrap()\n                })?;\n            let key = segments.next().ok_or_else(|| {\n                Response::builder()\n                    .status(400)\n                    .body(Some(\"Bad Request: Missing key\".to_string()))\n                    .unwrap()\n            })?;\n\n            // Make sure the key matches the expected key.\n            // VERY IMPORTANT: We cannot use normal string comparison here because it reveals information\n            // about the key based on timing information. Instead we use a constant time comparison method.\n            let key_matches: bool =\n                subtle::ConstantTimeEq::ct_eq(hex_encoded_client_key.as_ref(), key.as_bytes())\n                    .into();\n            if !key_matches {\n                return Err(Response::builder()","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/desktop/src/edits.rs#L286-L322","documentation":"The desktop IPC server rejected an HTTP request because the first path segment did not parse as a u32 webview ID. Requests must be of the form /<webview_id>/<key>; a malformed, empty, or non-numeric first segment triggers this 400 response.","triggerScenarios":"Thrown at packages/desktop/src/edits.rs:304 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The webview ID sent with the edit request does not match any live webview. Send edits to the ID returned when the webview was created, or recreate the webview."],"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-14T05:17:10.506Z"}