{"record":{"id":"7e955376a487e8dc","repo":"zed-industries/zed","slug":"copilot-is-disabled","errorCode":null,"errorMessage":"copilot is disabled","messagePattern":"copilot is disabled","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/copilot/src/copilot.rs","lineNumber":77,"sourceCode":"    Starting { task: Shared<Task<()>> },\n    Error(Arc<str>),\n    Running(RunningCopilotServer),\n}\n\nimpl CopilotServer {\n    fn as_authenticated(&mut self) -> Result<&mut RunningCopilotServer> {\n        let server = self.as_running()?;\n        anyhow::ensure!(\n            matches!(server.sign_in_status, SignInStatus::Authorized),\n            \"must sign in before using copilot\"\n        );\n        Ok(server)\n    }\n\n    fn as_running(&mut self) -> Result<&mut RunningCopilotServer> {\n        match self {\n            CopilotServer::Starting { .. } => anyhow::bail!(\"copilot is still starting\"),\n            CopilotServer::Disabled => anyhow::bail!(\"copilot is disabled\"),\n            CopilotServer::Error(error) => {\n                anyhow::bail!(\"copilot was not started because of an error: {error}\")\n            }\n            CopilotServer::Running(server) => Ok(server),\n        }\n    }\n}\n\nstruct RunningCopilotServer {\n    lsp: Arc<LanguageServer>,\n    sign_in_status: SignInStatus,\n    registered_buffers: HashMap<EntityId, RegisteredBuffer>,\n}\n\n#[derive(Clone, Debug)]\nenum SignInStatus {\n    Authorized,\n    Unauthorized,","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/copilot/src/copilot.rs#L59-L95","documentation":"as_running() returns this bail when the CopilotServer enum is in the Disabled variant — the integration was turned off (or never enabled) rather than merely not yet started. It is distinct from 'still starting' (state machine, not a toggle) and from the Error variant (startup attempted and failed). Any API call that requires a live language server will keep failing with this message until Copilot is enabled and started.","triggerScenarios":"Calling sign_in, completions, or buffer-registration entry points on a Copilot instance whose settings/disable path put it into CopilotServer::Disabled — e.g. the user disabled GitHub Copilot in settings, or the feature is gated off in this build/configuration.","commonSituations":"User toggled Copilot off in settings but an editor feature (inline completions, sign-in command) still tries to use it; CI builds where Copilot is disabled by default; races where a disable happens between a UI check and the API call.","solutions":["Enable GitHub Copilot in the editor settings and re-run the action","Guard call sites: check the Copilot status before invoking operations, and hide/disable the UI affordance when Copilot is off","If disabled state is unexpected, check for settings layers (user/project/default) that turn it off"],"exampleFix":"// before\ncopilot.update(cx, |c, cx| c.sign_in(cx)); // bails 'copilot is disabled'\n\n// after\nuse copilot::Status;\nif !matches!(copilot.read(cx).status(), Status::Disabled) {\n    copilot.update(cx, |c, cx| c.sign_in(cx));\n}","handlingStrategy":"validation","validationCode":"use copilot::Status;\n\nif matches!(copilot.read(cx).status(), Status::Disabled) {\n    return Ok(()); // feature off — skip Copilot-dependent behavior entirely\n}\nlet task = copilot.update(cx, |c, cx| c.sign_in(cx));","typeGuard":"fn copilot_enabled(copilot: &Entity<Copilot>, cx: &App) -> bool {\n    !matches!(copilot.read(cx).status(), Status::Disabled)\n}","tryCatchPattern":"match result {\n    Err(err) if err.to_string().contains(\"copilot is disabled\") => {\n        // configuration state — do not retry; prompt the user to enable Copilot\n        prompt_enable_copilot();\n    }\n    other => other,\n}","preventionTips":["Bind UI affordances to the Copilot status so disabled state never reaches the API","Check settings layers for an off switch before debugging deeper errors","Remember: Disabled is sticky until settings change — retrying the call cannot succeed"],"tags":["copilot","lifecycle","disabled","configuration"],"backgroundTag":"feature-disabled-by-config","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}