libnyanpasu/clash-nyanpasu · error

no mirrors found

Error message

no mirrors found

What it means

mirror_speed_test tests the INTERNAL_MIRRORS against a fixed GitHub version.json path and takes the fastest result. If the results slice is empty (no mirror produced any measurement), ok_or throws 'no mirrors found'. It indicates the mirror speed test returned no usable entries at all.

Source

Thrown at backend/tauri/src/core/updater/mod.rs:207

        self.manifest_version = latest;
        Ok(())
    }

    // TODO: add user-spec mirror support
    pub async fn mirror_speed_test(&self) -> Result<()> {
        {
            let mirror = self.mirror.read();
            if let Some((_, timestamp)) = mirror.as_ref()
                && chrono::Utc::now().timestamp() - (*timestamp as i64) < 3600
            {
                return Ok(());
            }
        }
        let mirrors = crate::utils::candy::INTERNAL_MIRRORS;
        let path = "https://github.com/libnyanpasu/clash-nyanpasu/raw/main/manifest/version.json";
        let client = crate::utils::candy::get_reqwest_client()?;
        let results = client.mirror_speed_test(mirrors, path).await?;
        let (fastest_mirror, speed) = results.first().ok_or(anyhow!("no mirrors found"))?;
        if speed - 1.0 < 0.0001 {
            anyhow::bail!("all mirrors are too slow");
        }
        tracing::debug!("fastest mirror: {}, speed: {}", fastest_mirror, speed);
        {
            let mut mirror = self.mirror.write();
            *mirror = Some((
                fastest_mirror.to_string(),
                chrono::Utc::now().timestamp() as u64,
            ));
        }
        Ok(())
    }

    pub async fn update_core(
        &mut self,
        core_type: &ClashCore,
        nyanpasu: crate::client::NyanpasuClient,

View on GitHub (pinned to f7dbce2997)

Solutions

  1. Check network connectivity and proxy settings; the mirror test needs outbound HTTPS to the mirror hosts
  2. Verify INTERNAL_MIRRORS is non-empty and hosts are reachable (curl each mirror URL)
  3. Inspect the reqwest client configuration (timeouts, proxy) used by get_reqwest_client

Example fix

// before
let (fastest_mirror, speed) = results.first().ok_or(anyhow!("no mirrors found"))?;
// after
if results.is_empty() { anyhow::bail!("mirror speed test failed: no mirror responded; check network/proxy"); }
let (fastest_mirror, speed) = results.first().unwrap();
Defensive patterns

Strategy: try-catch

Validate before calling

// probe connectivity before running the update flow
if reqwest::get("https://github.com").await.is_err() {
    eprintln!("network unavailable; mirror speed test will find no mirrors");
}

Try / catch

match updater.update_core(core_type, client).await {
    Ok(n) => n,
    Err(e) if e.to_string().contains("no mirrors found") || e.to_string().contains("too slow") => /* surface network/proxy guidance to user */,
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling fetch_latest or update_core, which invoke mirror_speed_test, when client.mirror_speed_test() returns an empty Vec - e.g. all mirror requests failed before producing a speed entry.

Common situations: Full network outage, firewall/proxy blocking all mirror hosts, DNS failures, or a reqwest client configured without usable network interfaces.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of libnyanpasu/clash-nyanpasu@f7dbce2997 (2026-09-08). Data as JSON: /api/errors/9e78e906919811b9. Report an issue: GitHub.