DioxusLabs/dioxus · error
Bad Request: Invalid webview ID
Error message
Bad Request: Invalid webview ID
What it means
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.
Source
Thrown at packages/desktop/src/edits.rs:304
let current_server_location = { *server_location.lock().unwrap() };
let hex_encoded_client_key = encode_key_string(¤t_server_location.client_key);
let hex_encoded_server_key = encode_key_string(¤t_server_location.server_key);
let mut location = None;
#[allow(clippy::result_large_err)]
let on_request = |req: &Request, res| {
// Try to parse the webview id and key from the path
let path = req.uri().path();
// The path should have two parts `/webview_id/key`
let mut segments = path.trim_matches('/').split('/');
let webview_id = segments
.next()
.and_then(|s| s.parse::<u32>().ok())
.ok_or_else(|| {
Response::builder()
.status(400)
.body(Some("Bad Request: Invalid webview ID".to_string()))
.unwrap()
})?;
let key = segments.next().ok_or_else(|| {
Response::builder()
.status(400)
.body(Some("Bad Request: Missing key".to_string()))
.unwrap()
})?;
// Make sure the key matches the expected key.
// VERY IMPORTANT: We cannot use normal string comparison here because it reveals information
// about the key based on timing information. Instead we use a constant time comparison method.
let key_matches: bool =
subtle::ConstantTimeEq::ct_eq(hex_encoded_client_key.as_ref(), key.as_bytes())
.into();
if !key_matches {
return Err(Response::builder()View on GitHub (pinned to 24f6a829df)
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.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/desktop/src/edits.rs:304 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/ee5a751746b02bae.
Report an issue: GitHub.