{"record":{"id":"29ff6637a710645f","repo":"lbjlaq/Antigravity-Manager","slug":"cloudflared-install-failed","errorCode":null,"errorMessage":"Cloudflared install failed","messagePattern":"Cloudflared install failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/pages/ApiProxy.tsx","lineNumber":302,"sourceCode":"    };\n\n    // Cloudflared: 启动/停止\n    const handleCfToggle = async (enable: boolean) => {\n        if (enable && !status.running) {\n            showToast(\n                t('proxy.cloudflared.require_proxy_running', { defaultValue: 'Please start the local proxy service first' }),\n                'warning'\n            );\n            return;\n        }\n        setCfLoading(true);\n        try {\n            if (enable) {\n                if (!cfStatus.installed) {\n                    const installStatus = await invoke<typeof cfStatus>('cloudflared_install');\n                    setCfStatus(installStatus);\n                    if (!installStatus.installed) {\n                        throw new Error('Cloudflared install failed');\n                    }\n                    showToast(t('proxy.cloudflared.install_success', { defaultValue: 'Cloudflared installed successfully' }), 'success');\n                }\n\n                const config = {\n                    enabled: true,\n                    mode: cfMode,\n                    port: appConfig?.proxy.port || 8045,\n                    token: cfMode === 'auth' ? cfToken : null,\n                    use_http2: cfUseHttp2,\n                };\n                const status = await invoke<typeof cfStatus>('cloudflared_start', { config });\n                setCfStatus(status);\n                showToast(t('proxy.cloudflared.started', { defaultValue: 'Tunnel started' }), 'success');\n\n                // 持久化“启用”状态\n                if (appConfig) {\n                    const newConfig = {","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/lbjlaq/Antigravity-Manager/blob/90a2b6b20797e2e593a83d0c54ab86037863fe70/src/pages/ApiProxy.tsx#L284-L320","documentation":"handleCfToggle invokes the cloudflared_install command and throws this if the returned status still reports installed=false after the install attempt, meaning the installer ran but cloudflared is not available.","triggerScenarios":"Toggling the Cloudflared proxy on when cfStatus.installed is false and the cloudflared_install command completes without successfully installing the binary (missing package manager, no network, unsupported platform, insufficient permissions).","commonSituations":"Linux distro without a supported install path; corporate proxy blocking the download; user lacks permission to install to the target bin directory.","solutions":["Install cloudflared manually (package manager or official binary on PATH) and re-toggle","Check the install command's logs/stderr — surface installStatus error details in the toast","Verify network access and proxy settings on the machine running the desktop app","Ensure the app has write permission to the install destination"],"exampleFix":"// before\nif (!installStatus.installed) {\n    throw new Error('Cloudflared install failed');\n}\n// after\nif (!installStatus.installed) {\n    throw new Error(`Cloudflared install failed: ${installStatus.error ?? 'unknown reason'}`);\n}","handlingStrategy":"try-catch","validationCode":"const which = await invoke('cloudflared_check'); if (!which.available) preWarnUser('cloudflared missing and auto-install may fail');","typeGuard":"null","tryCatchPattern":"try { await handleCfToggle(true); } catch (e) { showToast(e.message, 'error'); setCfStatus(s => ({ ...s, enabled: false })); }","preventionTips":["Check external binary availability before offering the toggle","Show installer stderr to the user on failure","Document manual install steps in-app"],"tags":["cloudflared","install","external-tool"],"backgroundTag":"command-not-found","analyzedSha":"90a2b6b20797e2e593a83d0c54ab86037863fe70","analyzedAt":"2026-09-19T08:34:01.322Z","contentChangedAt":"2026-09-19T08:34:01.322Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}