{"record":{"id":"ac67fb1829a306fc","repo":"libnyanpasu/clash-nyanpasu","slug":"pac-proxy-is-not-supported-on-this-platform","errorCode":null,"errorMessage":"PAC proxy is not supported on this platform","messagePattern":"PAC proxy is not supported on this platform","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/tauri/src/core/pac.rs","lineNumber":107,"sourceCode":"\n    /// Basic validation of PAC script structure - check for required functions\n    pub async fn validate_pac_script(script: &str) -> Result<()> {\n        // A basic validation without using the JS engine - just check if FindProxyForURL function exists\n        if !script.contains(\"FindProxyForURL\") {\n            return Err(anyhow::anyhow!(\n                \"PAC script must contain FindProxyForURL function\"\n            ));\n        }\n\n        // Additional basic checks could be added here if needed\n        Ok(())\n    }\n\n    /// Set system proxy to use PAC URL\n    pub fn set_pac_proxy(url: &str) -> Result<()> {\n        // Check if Autoproxy is supported on this platform\n        if !Autoproxy::is_support() {\n            return Err(anyhow::anyhow!(\n                \"PAC proxy is not supported on this platform\"\n            ));\n        }\n\n        let autoproxy = Autoproxy {\n            enable: true,\n            url: url.to_string(),\n        };\n\n        autoproxy\n            .set_auto_proxy()\n            .context(\"failed to set PAC proxy\")?;\n\n        Ok(())\n    }\n\n    /// Disable PAC proxy and revert to direct proxy\n    pub fn disable_pac_proxy() -> Result<()> {","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/libnyanpasu/clash-nyanpasu/blob/f7dbce2997c633e484f54788035e770b3ee99773/backend/tauri/src/core/pac.rs#L89-L125","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Switch the app from PAC mode to a fixed-port (system/HTTP) proxy mode, which sysproxy supports more broadly","Verify the platform actually supports autoproxy (Windows: yes; Linux: depends on desktop environment)","Upgrade the OS/desktop environment or install missing proxy-setting components (e.g. gsettings/PCS support)","Set the PAC URL manually in OS network settings instead of via the app","Handle the error and fall back to direct/fixed proxy configuration"],"exampleFix":"// before\nPac::set_pac_proxy(\"http://example.com/proxy.pac\")?;\n// after\nif Autoproxy::is_support() {\n    Pac::set_pac_proxy(\"http://example.com/proxy.pac\")?;\n} else {\n    sysproxy::Sysproxy { enable: true, host: \"127.0.0.1\", port, ..Default::default() }.set_system_proxy()?;\n}","handlingStrategy":"fallback","validationCode":"if !Autoproxy::is_support() {\n    // choose system/fixed proxy mode instead of PAC before calling set_pac_proxy\n}","typeGuard":"fn pac_supported() -> bool { Autoproxy::is_support() }","tryCatchPattern":"match set_pac_proxy(url) {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"not supported on this platform\") => {\n        switch_to_fixed_port_proxy()?;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Detect platform support before exposing PAC mode in settings/UI","Default to system (fixed-port) proxy mode on platforms without autoproxy","Document platform limitations for users migrating configs across OSes","Persist a proxy-mode that matches the current platform capabilities"],"tags":["platform","proxy","pac","unsupported"],"backgroundTag":"unsupported-platform","analyzedSha":"f7dbce2997c633e484f54788035e770b3ee99773","analyzedAt":"2026-09-08T01:24:59.197Z","contentChangedAt":"2026-09-08T01:24:59.197Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}