atuinsh/atuin · error

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

Error message

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

What it means

The `atuin account link` command links the local CLI account with a Hub session. It requires a CLI session token from the meta store; if none exists (the user never ran `atuin login` on this machine), it bails and instructs the user to log in first.

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 c0c717ab04)

Solutions

  1. Run `atuin login` to establish a CLI session, then retry `atuin account link`
  2. Verify ATUIN_CONFIG_DIR points at the config that contains your session token
  3. Re-login if the session was cleared or the meta store was recreated
  4. Link via the Hub web UI if CLI login is unavailable

Example fix

// before (fails: no CLI session)
atuin account link

// after
atuin login
atuin account link
Defensive patterns

Strategy: validation

Validate before calling

atuin status >/dev/null 2>&1 || { echo 'No CLI session: run `atuin login` before linking'; exit 1; }

Try / catch

if ! atuin account link; then
  echo "Link failed — ensure 'atuin login' was run on this machine" >&2
fi

Prevention

When it happens

Trigger: Running `atuin account link` when `meta.session_token()` returns None — i.e. no prior `atuin login`, a logged-out state, or an ATUIN_CONFIG_DIR pointing to a fresh meta store without a CLI session.

Common situations: Setting up Hub linking on a brand-new machine; CI containers without a logged-in CLI; accidentally using a different config directory than the one holding the session; after clearing the meta store.

Related errors


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