Hmbown/CodeWhale · error

Connection degraded (failures={}): {}

Error message

Connection degraded (failures={}): {}

What it means

mark_request_failure records the failure in connection_health; when the failure count crosses the degradation threshold, the client logs "Connection degraded (failures=N): reason" and the rate limiter backs off subsequent requests with increasing delay. It is an adaptive health signal for repeated request failures (network errors, 5xx, timeouts) — recovery is logged separately by mark_request_success.

Source

Thrown at crates/tui/src/client.rs:2534

            let mut limiter = self.rate_limiter.lock().await;
            limiter.delay_until_available(1.0)
        };
        if let Some(delay) = maybe_delay {
            tokio::time::sleep(delay).await;
        }
    }

    async fn mark_request_success(&self) {
        let mut health = self.connection_health.lock().await;
        if apply_request_success(&mut health, Instant::now()) {
            logging::info("Connection recovered");
        }
    }

    async fn mark_request_failure(&self, reason: &str) {
        let mut health = self.connection_health.lock().await;
        apply_request_failure(&mut health, Instant::now());
        logging::warn(format!(
            "Connection degraded (failures={}): {}",
            health.consecutive_failures, reason
        ));
    }

    async fn maybe_probe_recovery(&self) {
        let should_probe = {
            let mut health = self.connection_health.lock().await;
            mark_recovery_probe_if_due(&mut health, Instant::now())
        };
        if !should_probe {
            return;
        }
        if api_provider_skips_models_probe(self.api_provider) {
            self.mark_request_success().await;
            logging::info("Skipping /models recovery probe for provider without a models endpoint");
            return;
        }

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Read the trailing reason to identify the failing request class (timeout, connect, HTTP status)
  2. Wait for the rate limiter backoff; requests resume automatically after delays elapse
  3. Check endpoint reachability/credentials if failures keep accumulating; recovery is logged as 'Connection recovered'
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/tui/src/client.rs:2534 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/ef6cc6b66f5e6162. Report an issue: GitHub.