{"record":{"id":"d49b05fd5d39c7ad","repo":"clash-verge-rev/clash-verge-rev","slug":"sidecar-did-not-become-ready","errorCode":null,"errorMessage":"Sidecar did not become ready","messagePattern":"Sidecar did not become ready","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"critical","filePath":"src-tauri/src/core/manager/lifecycle.rs","lineNumber":309,"sourceCode":"        }\n        defer! {\n            self.finish_config_update();\n        }\n        let _life = self.lifecycle_lock.lock().await;\n        let status = SERVICE_MANAGER.current().await;\n        let mode = self.get_running_mode();\n        if !can_allow_sidecar_for_session(&mode, &status) {\n            anyhow::bail!(\"Sidecar continuation is not allowed from {mode:?} / {status:?}\");\n        }\n        Config::suppress_tun_for_session().await;\n        Config::generate().await?;\n        SERVICE_MANAGER.allow_sidecar_for_session()?;\n        // Drop the guard last so an earlier failure cannot leave a running Sidecar unguarded.\n        proxy_control::stop_guard().await;\n        let result = async {\n            self.start_core_inner().await?;\n            if !matches!(*self.get_running_mode(), RunningMode::Sidecar) {\n                anyhow::bail!(\"Sidecar did not become ready\");\n            }\n            self.apply_proxy_after_start().await\n        }\n        .await;\n        if let Err(error) = &result {\n            // Revoke only the failed Sidecar allowance; its startup says nothing about Service health.\n            SERVICE_MANAGER.withdraw_sidecar_allowance();\n            if let Err(cleanup_error) = self.rollback_failed_sidecar_transition().await {\n                return Err(anyhow::anyhow!(\n                    \"Sidecar startup failed: {error:#}; failed to clear proxy before rollback: {cleanup_error:#}\"\n                ));\n            }\n        }\n        result\n    }\n\n    pub async fn uninstall_service_and_start_sidecar(&self) -> Result<()> {\n        if !self.try_start_config_update() {","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/clash-verge-rev/clash-verge-rev/blob/5cad0f2799e74b1105e133bcfc2a45f5c1370ef1/src-tauri/src/core/manager/lifecycle.rs#L291-L327","documentation":"Thrown inside continue_with_sidecar after start_core_inner succeeded but the running mode did not transition to RunningMode::Sidecar. The core started, but the mode reported by get_running_mode is not Sidecar, meaning the process is not the sidecar the caller asked for (e.g. it became a service-managed core, or stopped immediately).","triggerScenarios":"start_core_inner returned Ok but the mode tracking did not flip to Sidecar — e.g. the service intercepted the start, the mode was overwritten by a concurrent transition, or start_core_inner started a service-mode core by mistake.","commonSituations":"A race between the sidecar allowance and the service manager; the service was still alive and grabbed the core; mode detection reads stale state right after spawn; the sidecar binary path resolved to the service launcher.","solutions":["Check service status and ensure the service is not concurrently starting the core.","Inspect the mode right after start_core_inner in logs to see what it transitioned to.","Retry after the service finishes its current operation or uninstall it.","Verify the start_core_inner branch genuinely launches a sidecar process under the current mode."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(e) = manager.continue_with_sidecar().await {\n    if e.to_string().contains(\"did not become ready\") {\n        // the core started in a different mode; check service status and retry\n        inspect_mode_mismatch().await;\n    }\n}","preventionTips":["Ensure no service-managed core is starting concurrently.","Verify start_core_inner launches a sidecar process under the current mode.","Sample the mode immediately after start to catch a flip early.","Retry the full transition after clearing conflicting processes."],"tags":["core","sidecar","lifecycle","mode-transition"],"analyzedSha":"5cad0f2799e74b1105e133bcfc2a45f5c1370ef1","analyzedAt":"2026-08-12T03:25:57.699Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}