Hmbown/CodeWhale · error · anyhow::Error

Not signed in. Run `codewhale login` first

Error message

Not signed in. Run `codewhale login` first

What it means

execute_authenticated_snapshot takes a snapshot of the local account store before making an authenticated cloud request. If the store holds no saved session at all, there is no access token to attach, so it throws this error directing the user to `codewhale login`.

Solutions

  1. Run `codewhale login` to create a session.
  2. If you already logged in, check you are running as the same user/HOME (CI vs interactive shell) so the store is visible.
  3. Verify the account store file exists in the expected config directory; re-login if it was deleted.

Example fix

// before
codewhale me
// after
codewhale login
codewhale me
Defensive patterns

Strategy: validation

Validate before calling

// shell
if ! codewhale me >/dev/null 2>&1; then
  echo "not signed in"; exit 1
fi

Try / catch

// Rust
match cloud.call_authenticated(req) {
    Err(e) if e.to_string().contains("Not signed in") => {
        // prompt for `codewhale login` and retry once authenticated
    }
    other => other,
}

Prevention

When it happens

Trigger: Any authenticated cloud CLI command (me, key set/list, provider operations via execute_authenticated) run before ever logging in, or after the account store was cleared/removed.

Common situations: Fresh machine or CI environment without a prior `codewhale login`; deleted/corrupted account store file; HOME or config-dir environment differences hiding the stored session.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/e0ba8866947843ae. Report an issue: GitHub.

Appendix: source

Thrown at crates/cli/src/cloud.rs:548

    fn execute_authenticated(
        &self,
        method: HttpMethod,
        path: &str,
        body: Option<Vec<u8>>,
    ) -> Result<CloudResponse> {
        self.execute_authenticated_snapshot(method, path, body)
            .map(|(response, _)| response)
    }

    fn execute_authenticated_snapshot(
        &self,
        method: HttpMethod,
        path: &str,
        body: Option<Vec<u8>>,
    ) -> Result<(CloudResponse, AccountSessionSnapshot)> {
        let snapshot = self.account_store.snapshot()?;
        let Some(mut stored) = snapshot.load()? else {
            bail!("Not signed in. Run `codewhale login` first");
        };
        let first = self.transport.execute(CloudRequest {
            method,
            path: path.into(),
            bearer: Some(stored.bundle.access_token.clone()),
            body: body.clone(),
        })?;
        if first.status != 401 {
            return Ok((first, snapshot));
        }
        // Serialize the refresh HTTP request itself with native/CLI writers:
        // two processes must not spend the same rotating refresh token.
        let renewed = self
            .account_store
            .with_transaction(|transaction| -> Result<_> {
                if !transaction.matches(&snapshot) {
                    bail!("The signed-in account changed. Refresh and try again.");
                }

View on GitHub (pinned to 73e0f67d83)