atuinsh/atuin · error

No CLI session found. Please log in first with 'atuin…

Error message

No CLI session found. Please log in first with 'atuin login'.

What it means

`atuin account link` needs the local CLI session token to link the CLI account with a Hub account, but the meta store returned no CLI session. The command bails and tells the user to log in first, since linking is meaningless without an authenticated CLI session.

Solutions

  1. Run `atuin login` (or `atuin register`) first, then retry `atuin account link`
  2. Point ATUIN_HOME at the directory that holds your existing CLI session
  3. Verify session state exists before linking (e.g. a successful sync run implies a session)

Example fix

// before
atuin account link
// after
atuin login
atuin account link
Defensive patterns

Strategy: validation

Validate before calling

atuin login || { echo 'CLI login required before link'; exit 1; }

Try / catch

atuin account link || { echo 'Run atuin login first'; exit 1; }

Prevention

When it happens

Trigger: Running `atuin account link` before `atuin login`; running it on a machine where only Hub browser sessions exist but the CLI was never logged in; session token cleared by logout or a fresh data directory.

Common situations: Setting up a new workstation and running link before login; CI environments with no session; mixing ATUIN_HOME directories so the token lives elsewhere.

Related errors


AI-assisted analysis of atuinsh/atuin@900007c480 (2026-09-19). Data as JSON: /api/errors/3fe3b17043d84734. Report an issue: GitHub.

Appendix: source

Thrown at crates/atuin/src/command/client/account/link.rs:11

use atuin_client::settings::Settings;
use eyre::{Result, bail};

pub async fn run(settings: &Settings) -> Result<()> {
    let meta = Settings::meta_store().await?;

    let cli_token = meta.session_token().await?;
    let hub_token = meta.hub_session_token().await?;

    let Some(cli_token) = cli_token else {
        bail!("No CLI session found. Please log in first with 'atuin login'.");
    };

    let hub_address = settings.hub_endpoint();

    if hub_token.is_some() {
        println!("Found both Hub and CLI sessions. Linking accounts...");
    } else {
        println!("Found CLI session but no Hub session. Logging in to Hub first...");

        let session = atuin_client::hub::HubAuthSession::start(&hub_address).await?;
        println!("Open this URL to authenticate with Atuin Hub:");
        println!("{}", session.auth_url);

        let token = session
            .wait_for_completion(
                atuin_client::hub::DEFAULT_AUTH_TIMEOUT,
                atuin_client::hub::DEFAULT_POLL_INTERVAL,
            )

View on GitHub (pinned to 900007c480)