Hmbown/CodeWhale · warning · anyhow::Error

Not signed in. Run `codewhale account login` first

Error message

Not signed in. Run `codewhale account login` first

What it means

execute_authenticated is the gate for all authenticated cloud calls: it loads the stored session from the OS credential store, and when none exists it bails with this sign-in required message before any HTTP request is made. It is purely local state — no network round trip happened.

Source

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

            .execute(CloudRequest {
                method: HttpMethod::Post,
                path: "/api/auth/logout".to_string(),
                bearer: None,
                body: Some(body),
            })
            .is_ok_and(|response| (200..300).contains(&response.status));
        self.clear_auth()?;
        Ok(remote_revoked)
    }

    fn execute_authenticated(
        &self,
        method: HttpMethod,
        path: &str,
        body: Option<Vec<u8>>,
    ) -> Result<CloudResponse> {
        let Some(mut stored) = self.load_auth()? else {
            bail!("Not signed in. Run `codewhale account login` first");
        };
        let first = self.transport.execute(CloudRequest {
            method,
            path: path.to_string(),
            bearer: Some(stored.bundle.access_token.clone()),
            body: body.clone(),
        })?;
        if first.status != 401 {
            return Ok(first);
        }

        let refresh = self.transport.execute(CloudRequest {
            method: HttpMethod::Post,
            path: "/api/auth/refresh".to_string(),
            bearer: None,
            body: Some(json_body(&RefreshRequest {
                refresh_token: &stored.bundle.refresh_token,
            })?),

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Run `codewhale account login` and complete the device flow.
  2. If you logged in before, check you are using the same --profile the session was stored under.
  3. Confirm the OS credential manager is unlocked (Keychain/Secret Service) so the stored session can be read.
  4. If login previously failed mid-way, rerun it — the bundle is only stored on success.

Example fix

# before
codewhale account keys set anthropic

# after
codewhale account login && codewhale account keys set anthropic
Defensive patterns

Strategy: validation

Validate before calling

// Check for a session before dispatching account commands
if account_store.load()?.is_none() {
    eprintln!("Not signed in — starting login");
    run_login(profile).await?;
}

Try / catch

match client.execute_authenticated(method, path, body).await {
    Ok(resp) => resp,
    Err(e) if e.to_string().contains("Not signed in") => {
        run_login(profile).await?;               // then retry the original call once
        client.execute_authenticated(method, path, body).await
    }
    Err(e) => Err(e),
}

Prevention

When it happens

Trigger: Running `codewhale account keys set`, `account me`, `account logout`, push/pull, or any command routed through execute_authenticated before ever completing `codewhale account login`; or after logout/remote revocation cleared the stored bundle.

Common situations: Fresh machine/container with no session, session cleared by `account logout` or by a 401-triggered clear_auth from errors 28/29, keyring entry deleted manually, or a different --profile than the one logged in.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/0a5b3b1609e48947. Report an issue: GitHub.