{"record":{"id":"d0cfbf29bf5d43f9","repo":"libnyanpasu/clash-nyanpasu","slug":"direct-proxy-is-not-supported-on-this-platform","errorCode":null,"errorMessage":"Direct proxy is not supported on this platform","messagePattern":"Direct proxy is not supported on this platform","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/tauri/src/core/pac.rs","lineNumber":150,"sourceCode":"        let autoproxy = Autoproxy {\n            enable: false,\n            url: String::new(),\n        };\n\n        autoproxy\n            .set_auto_proxy()\n            .context(\"failed to disable PAC proxy\")?;\n\n        Ok(())\n    }\n\n    /// Fallback to direct proxy when PAC fails\n    pub fn fallback_to_direct_proxy() -> Result<()> {\n        log::warn!(target: \"app\", \"Falling back to direct proxy mode\");\n\n        // Check if Sysproxy is supported on this platform\n        if !sysproxy::Sysproxy::is_support() {\n            return Err(anyhow::anyhow!(\n                \"Direct proxy is not supported on this platform\"\n            ));\n        }\n\n        // Get the standard proxy settings\n        let port = Config::verge()\n            .latest()\n            .verge_mixed_port\n            .unwrap_or(Config::clash().data().get_mixed_port());\n\n        let (enable, bypass) = {\n            let verge = Config::verge();\n            let verge = verge.latest();\n            (\n                verge.enable_system_proxy.unwrap_or(false),\n                verge.system_proxy_bypass.clone(),\n            )\n        };","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/libnyanpasu/clash-nyanpasu/blob/f7dbce2997c633e484f54788035e770b3ee99773/backend/tauri/src/core/pac.rs#L132-L168","documentation":"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.","triggerScenarios":"Calling fallback_to_direct_proxy() (directly or via update_pac's failure path) on a platform where sysproxy::Sysproxy::is_support() returns false.","commonSituations":"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.","solutions":["Configure the proxy manually at the OS or shell level (http_proxy/https_proxy env vars)","Upgrade to a platform/desktop environment that exposes system proxy settings","Use the app's internal proxy port directly in applications instead of system-wide proxying","Handle the error gracefully — log and continue with no system proxy (the app itself still proxies traffic)","Check platform support before offering system-proxy features in the UI"],"exampleFix":"// caller-side\nif let Err(e) = Pac::fallback_to_direct_proxy() {\n    log::warn!(\"system proxy unavailable on this platform: {e}; set env vars manually\");\n}","handlingStrategy":"try-catch","validationCode":"if !sysproxy::Sysproxy::is_support() {\n    // skip system proxy entirely; rely on in-app proxy port / env vars\n}","typeGuard":"fn sysproxy_supported() -> bool { sysproxy::Sysproxy::is_support() }","tryCatchPattern":"match fallback_to_direct_proxy() {\n    Ok(()) => log::info!(\"direct system proxy active\"),\n    Err(e) => log::warn!(\"no system proxy backend: {e}; configure env vars manually\"),\n}","preventionTips":["Check Sysproxy::is_support() before any system-proxy operation","On unsupported platforms, guide users to set http_proxy/https_proxy manually","Keep the in-app mixed port documented as the universal fallback","Avoid advertising system-proxy features in UI on unsupported platforms"],"tags":["platform","proxy","sysproxy","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"}