libnyanpasu/clash-nyanpasu · error

PAC proxy is not supported on this platform

Error message

PAC proxy is not supported on this platform

What it means

set_pac_proxy configures the operating system to use a PAC (auto-proxy) URL. Before doing so it checks Autoproxy::is_support(); PAC/auto-proxy configuration is not implemented for every platform supported by the app (historically unsupported on Linux without a supporting desktop environment). If unsupported, this error is returned and no system proxy change is made.

Source

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

    /// Basic validation of PAC script structure - check for required functions
    pub async fn validate_pac_script(script: &str) -> Result<()> {
        // A basic validation without using the JS engine - just check if FindProxyForURL function exists
        if !script.contains("FindProxyForURL") {
            return Err(anyhow::anyhow!(
                "PAC script must contain FindProxyForURL function"
            ));
        }

        // Additional basic checks could be added here if needed
        Ok(())
    }

    /// Set system proxy to use PAC URL
    pub fn set_pac_proxy(url: &str) -> Result<()> {
        // Check if Autoproxy is supported on this platform
        if !Autoproxy::is_support() {
            return Err(anyhow::anyhow!(
                "PAC proxy is not supported on this platform"
            ));
        }

        let autoproxy = Autoproxy {
            enable: true,
            url: url.to_string(),
        };

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

        Ok(())
    }

    /// Disable PAC proxy and revert to direct proxy
    pub fn disable_pac_proxy() -> Result<()> {

View on GitHub (pinned to f7dbce2997)

Solutions

  1. Switch the app from PAC mode to a fixed-port (system/HTTP) proxy mode, which sysproxy supports more broadly
  2. Verify the platform actually supports autoproxy (Windows: yes; Linux: depends on desktop environment)
  3. Upgrade the OS/desktop environment or install missing proxy-setting components (e.g. gsettings/PCS support)
  4. Set the PAC URL manually in OS network settings instead of via the app
  5. Handle the error and fall back to direct/fixed proxy configuration

Example fix

// before
Pac::set_pac_proxy("http://example.com/proxy.pac")?;
// after
if Autoproxy::is_support() {
    Pac::set_pac_proxy("http://example.com/proxy.pac")?;
} else {
    sysproxy::Sysproxy { enable: true, host: "127.0.0.1", port, ..Default::default() }.set_system_proxy()?;
}
Defensive patterns

Strategy: fallback

Validate before calling

if !Autoproxy::is_support() {
    // choose system/fixed proxy mode instead of PAC before calling set_pac_proxy
}

Type guard

fn pac_supported() -> bool { Autoproxy::is_support() }

Try / catch

match set_pac_proxy(url) {
    Ok(()) => {},
    Err(e) if e.to_string().contains("not supported on this platform") => {
        switch_to_fixed_port_proxy()?;
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling set_pac_proxy(url) on a platform where Autoproxy::is_support() returns false — e.g. Linux builds lacking the autoproxy backend, while Windows/macOS support it.

Common situations: Running the app on Linux where system-wide PAC is unavailable; headless/CI environments; a platform regression after upgrading OS libraries; users expecting PAC behavior that the OS backend cannot set.

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/ac67fb1829a306fc. Report an issue: GitHub.