zed-industries/zed · error

must sign in before using copilot

Error message

must sign in before using copilot

What it means

as_authenticated asserts the Copilot server's sign_in_status is Authorized; any other state (NotSignedIn, SigningIn, Error) fails this guard. It is a precondition check — the caller attempted a Copilot request before sign-in completed.

Solutions

  1. Complete Copilot sign-in (e.g. the sign-in action) before issuing requests
  2. If sign-in is in progress, wait for it to finish before retrying
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/copilot/src/copilot.rs:67 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/e92b3fc4f4df3596. Report an issue: GitHub.

Appendix: source

Thrown at crates/copilot/src/copilot.rs:67

    copilot_edit_predictions,
    [
        /// Reinstalls the Copilot Edit Predictions language server.
        #[action(deprecated_aliases = ["copilot::Reinstall"])]
        Reinstall,
    ]
);

enum CopilotServer {
    Disabled,
    Starting { task: Shared<Task<()>> },
    Error(Arc<str>),
    Running(RunningCopilotServer),
}

impl CopilotServer {
    fn as_authenticated(&mut self) -> Result<&mut RunningCopilotServer> {
        let server = self.as_running()?;
        anyhow::ensure!(
            matches!(server.sign_in_status, SignInStatus::Authorized),
            "must sign in before using copilot"
        );
        Ok(server)
    }

    fn as_running(&mut self) -> Result<&mut RunningCopilotServer> {
        match self {
            CopilotServer::Starting { .. } => anyhow::bail!("copilot is still starting"),
            CopilotServer::Disabled => anyhow::bail!("copilot is disabled"),
            CopilotServer::Error(error) => {
                anyhow::bail!("copilot was not started because of an error: {error}")
            }
            CopilotServer::Running(server) => Ok(server),
        }
    }
}

View on GitHub (pinned to f4178619ac)