DioxusLabs/dioxus · error

Backend not ready after

Error message

Backend not ready after {max_wait:?}: {e}

What it means

Retry exhaustion in send_with_retry (called from proxy_to): the proxy loop retried TcpStream::connect to the configured backend host:port with exponential backoff (100ms doubling, capped at 2s) until the 30-second max_wait elapsed without a successful connection. This means the proxied backend never came up — the inputs at fault are the backend address and the last connection error shown.

Solutions

  1. The backend did not become ready in time. Ensure the backend server starts cleanly; fix its startup errors.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at packages/cli/src/serve/proxy.rs:42 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@fda3dc9c2b (2026-08-23). Data as JSON: /api/errors/8e6b69d790cdc8d3. Report an issue: GitHub.

Appendix: source

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

    url: &Uri,
    req: Request<MyBody>,
    handle_error: fn(Error) -> Response<Body>,
) -> std::result::Result<Response<hyper::body::Incoming>, Response<Body>> {
    let host = url.host().unwrap_or("127.0.0.1");
    let port = url.port_u16().unwrap_or(80);
    let addr = format!("{host}:{port}");

    let mut backoff = std::time::Duration::from_millis(100);
    let max_wait = std::time::Duration::from_secs(30);
    let start = std::time::Instant::now();

    // Retry TCP connect until backend is ready
    let stream = loop {
        match TcpStream::connect(&addr).await {
            Ok(stream) => break stream,
            Err(e) => {
                if start.elapsed() >= max_wait {
                    return Err(handle_error(anyhow::anyhow!(
                        "Backend not ready after {max_wait:?}: {e}"
                    )));
                }
                tracing::debug!("Backend not ready, retrying in {backoff:?}...");
                tokio::time::sleep(backoff).await;
                backoff = (backoff * 2).min(std::time::Duration::from_secs(2));
            }
        }
    };

    // Wrap the TCP stream for hyper
    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}")))?;

View on GitHub (pinned to fda3dc9c2b)