libnyanpasu/clash-nyanpasu · error

Direct proxy is not supported on this platform

Error message

Direct proxy is not supported on this platform

What it means

fallback_to_direct_proxy is the safety net used when PAC setup fails: it configures the system proxy to a standard fixed-port (direct HTTP) proxy. It first checks sysproxy::Sysproxy::is_support(); if the platform has no system-proxy backend this error is thrown and the app cannot set any system proxy.

Source

Thrown at backend/tauri/src/core/pac.rs:150

        let autoproxy = Autoproxy {
            enable: false,
            url: String::new(),
        };

        autoproxy
            .set_auto_proxy()
            .context("failed to disable PAC proxy")?;

        Ok(())
    }

    /// Fallback to direct proxy when PAC fails
    pub fn fallback_to_direct_proxy() -> Result<()> {
        log::warn!(target: "app", "Falling back to direct proxy mode");

        // Check if Sysproxy is supported on this platform
        if !sysproxy::Sysproxy::is_support() {
            return Err(anyhow::anyhow!(
                "Direct proxy is not supported on this platform"
            ));
        }

        // Get the standard proxy settings
        let port = Config::verge()
            .latest()
            .verge_mixed_port
            .unwrap_or(Config::clash().data().get_mixed_port());

        let (enable, bypass) = {
            let verge = Config::verge();
            let verge = verge.latest();
            (
                verge.enable_system_proxy.unwrap_or(false),
                verge.system_proxy_bypass.clone(),
            )
        };

View on GitHub (pinned to f7dbce2997)

Solutions

  1. Configure the proxy manually at the OS or shell level (http_proxy/https_proxy env vars)
  2. Upgrade to a platform/desktop environment that exposes system proxy settings
  3. Use the app's internal proxy port directly in applications instead of system-wide proxying
  4. Handle the error gracefully — log and continue with no system proxy (the app itself still proxies traffic)
  5. Check platform support before offering system-proxy features in the UI

Example fix

// caller-side
if let Err(e) = Pac::fallback_to_direct_proxy() {
    log::warn!("system proxy unavailable on this platform: {e}; set env vars manually");
}
Defensive patterns

Strategy: try-catch

Validate before calling

if !sysproxy::Sysproxy::is_support() {
    // skip system proxy entirely; rely on in-app proxy port / env vars
}

Type guard

fn sysproxy_supported() -> bool { sysproxy::Sysproxy::is_support() }

Try / catch

match fallback_to_direct_proxy() {
    Ok(()) => log::info!("direct system proxy active"),
    Err(e) => log::warn!("no system proxy backend: {e}; configure env vars manually"),
}

Prevention

When it happens

Trigger: Calling fallback_to_direct_proxy() (directly or via update_pac's failure path) on a platform where sysproxy::Sysproxy::is_support() returns false.

Common situations: Linux environments without a supported system-proxy mechanism; containerized/headless runs with no desktop proxy settings; both PAC and sysproxy unavailable, leaving only in-app proxying.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


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