warpdotdev/warp · error · anyhow::Error

User should be logged in

Error message

User should be logged in

What it means

`resolve_owner` with `user_flag=true` needs the logged-in user's uid from `AuthStateProvider`. `user_id()` returning None means there is no authenticated user, so `--personal` object creation fails with 'User should be logged in'.

Source

Thrown at app/src/ai/agent_sdk/common.rs:115

/// Resolve the owner of a new cloud object. This resolution is based on the CLI `--team` and `--personal` flags.
///
/// If `team_flag` is true, attempts to get the current team UID (errors if not on a team).
/// If `user_flag` is true, gets the current user's UID.
/// Otherwise, defaults to team if available, falling back to user.
pub fn resolve_owner(team_flag: bool, user_flag: bool, ctx: &AppContext) -> anyhow::Result<Owner> {
    if team_flag {
        let team_id = UserWorkspaces::as_ref(ctx)
            .sole_team_uid()
            .ok_or_else(|| anyhow::anyhow!("User is not on a team"))?;
        return Ok(Owner::Team { team_uid: team_id });
    }

    if user_flag {
        let user_id = AuthStateProvider::as_ref(ctx)
            .get()
            .user_id()
            .ok_or_else(|| anyhow::anyhow!("User should be logged in"))?;
        return Ok(Owner::User { user_uid: user_id });
    }

    // Default: try team first, fall back to user
    if let Some(team_uid) = UserWorkspaces::as_ref(ctx).sole_team_uid() {
        return Ok(Owner::Team { team_uid });
    }

    log::warn!("Tried to default to creating team object, team could not be found.");
    let user_id = AuthStateProvider::as_ref(ctx)
        .get()
        .user_id()
        .ok_or_else(|| anyhow::anyhow!("User should be logged in"))?;
    Ok(Owner::User { user_uid: user_id })
}

/// Refresh workspace metadata before executing an operation.
///

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Log in (`warp login`) and retry
  2. Check login status before scripting personal-object commands
  3. For CI, provision credentials / API key access non-interactively
  4. If auth is still loading at startup, retry after initialization completes

Example fix

# before
warp launch-configs create --personal cfg
# after
warp login && warp launch-configs create --personal cfg
Defensive patterns

Strategy: validation

Validate before calling

fn is_logged_in(ctx: &AppContext) -> bool {
    AuthStateProvider::as_ref(ctx).get().user_id().is_some()
}
// Gate --personal flows on this; prompt login otherwise.

Prevention

When it happens

Trigger: Passing `--personal` while the CLI has no auth session — never logged in, logged out, or the auth state is not yet hydrated — so `AuthStateProvider::as_ref(ctx).get().user_id()` is None.

Common situations: Fresh installs; CI runners with no credentials; expired or signed-out sessions; commands issued during early startup before auth loads.

Related errors


AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16). Data as JSON: /api/errors/54eaf37b260108ff. Report an issue: GitHub.