DioxusLabs/dioxus · error · anyhow::Error

Request failed: {e}

Error message

Request failed: {e}

What it means

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.

Source

Thrown at packages/cli/src/serve/proxy.rs:72

    let io = TokioIo::new(stream);

    // Perform HTTP/1.1 handshake on the same connection
    let (mut sender, conn) = http1::handshake(io)
        .await
        .map_err(|e| handle_error(anyhow::anyhow!("HTTP handshake failed: {e}")))?;

    // Spawn connection driver to keep it alive
    tokio::spawn(async move {
        if let Err(e) = conn.await {
            tracing::debug!("Connection closed: {e}");
        }
    });

    // Send request through the established connection (streaming body)
    sender
        .send_request(req)
        .await
        .map_err(|e| handle_error(anyhow::anyhow!("Request failed: {e}")))
}

/// Add routes to the router handling the specified proxy config.
///
/// We will proxy requests directed at either:
///
/// - the exact path of the proxy config's backend URL, e.g. /api
/// - the exact path with a trailing slash, e.g. /api/
/// - any subpath of the backend URL, e.g. /api/foo/bar
pub(crate) fn add_proxy(mut router: Router, proxy: &WebProxyConfig) -> Result<Router> {
    let url: Uri = proxy.backend.parse()?;
    let path = url.path().to_string();
    let trimmed_path = path.trim_start_matches('/');

    if trimmed_path.is_empty() {
        bail!(
            "Proxy backend URL must have a non-empty path, e.g. {}/api instead of {}",
            proxy.backend.trim_end_matches('/'),

View on GitHub (pinned to 393d190a80)

Solutions

  1. Check the backend logs — it most likely crashed or reset the connection while processing the request
  2. Reproduce with curl against the backend using the same method, path, and body
  3. For streaming request bodies, make sure the generator never errors or aborts mid-stream
  4. Retry the request: transient resets during backend restarts/reloads are common in development
Defensive patterns

Strategy: retry

Validate before calling

# Smoke-test the exact request the UI makes before blaming the proxy
curl -X POST -H 'content-type: application/json' -d '{"k":1}' http://127.0.0.1:8080/api/items

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of DioxusLabs/dioxus@393d190a80 (2026-08-16). Data as JSON: /api/errors/282c93822bb7c61d. Report an issue: GitHub.