{"record":{"id":"282c93822bb7c61d","repo":"DioxusLabs/dioxus","slug":"request-failed-e","errorCode":null,"errorMessage":"Request failed: {e}","messagePattern":"Request failed: (.+?)","errorType":"http","errorClass":"anyhow::Error","httpStatus":500,"severity":"error","filePath":"packages/cli/src/serve/proxy.rs","lineNumber":72,"sourceCode":"    let io = TokioIo::new(stream);\n\n    // Perform HTTP/1.1 handshake on the same connection\n    let (mut sender, conn) = http1::handshake(io)\n        .await\n        .map_err(|e| handle_error(anyhow::anyhow!(\"HTTP handshake failed: {e}\")))?;\n\n    // Spawn connection driver to keep it alive\n    tokio::spawn(async move {\n        if let Err(e) = conn.await {\n            tracing::debug!(\"Connection closed: {e}\");\n        }\n    });\n\n    // Send request through the established connection (streaming body)\n    sender\n        .send_request(req)\n        .await\n        .map_err(|e| handle_error(anyhow::anyhow!(\"Request failed: {e}\")))\n}\n\n/// Add routes to the router handling the specified proxy config.\n///\n/// We will proxy requests directed at either:\n///\n/// - the exact path of the proxy config's backend URL, e.g. /api\n/// - the exact path with a trailing slash, e.g. /api/\n/// - any subpath of the backend URL, e.g. /api/foo/bar\npub(crate) fn add_proxy(mut router: Router, proxy: &WebProxyConfig) -> Result<Router> {\n    let url: Uri = proxy.backend.parse()?;\n    let path = url.path().to_string();\n    let trimmed_path = path.trim_start_matches('/');\n\n    if trimmed_path.is_empty() {\n        bail!(\n            \"Proxy backend URL must have a non-empty path, e.g. {}/api instead of {}\",\n            proxy.backend.trim_end_matches('/'),","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/cli/src/serve/proxy.rs#L54-L90","documentation":"Once the connection is established and its driver task spawned, send_with_retry forwards the (possibly streaming) request via sender.send_request. Any failure at this stage — the backend resetting the connection mid-request, a request-body I/O error while streaming, or the spawned connection task dying — is mapped through handle_error into this message.","triggerScenarios":"The backend accepts the TCP connection then drops or resets it while handling the request: crash mid-handler, body-size rejection, or the client-side streaming body generator failing; also idle kills between handshake and request send.","commonSituations":"Backend framework crashing on a specific payload; reverse proxies closing long-lived connections; dev-server reloads restarting the backend under an in-flight request; streaming uploads whose producer aborts.","solutions":["Check the backend logs — it most likely crashed or reset the connection while processing the request","Reproduce with curl against the backend using the same method, path, and body","For streaming request bodies, make sure the generator never errors or aborts mid-stream","Retry the request: transient resets during backend restarts/reloads are common in development"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# Smoke-test the exact request the UI makes before blaming the proxy\ncurl -X POST -H 'content-type: application/json' -d '{\"k\":1}' http://127.0.0.1:8080/api/items","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Watch backend logs during development to catch mid-request crashes","Keep request bodies within the backend's limits","Treat single failures during backend reloads as transient; retry before debugging"],"tags":["cli","dev-server","proxy","network","streaming"],"backgroundTag":null,"analyzedSha":"393d190a801ccb441d41923e232289b4f8a5c669","analyzedAt":"2026-08-16T11:27:45.815Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}