{"record":{"id":"5c420647590aba9a","repo":"warpdotdev/warp","slug":"you-are-not-logged-in-please-log-in-with-cli-n","errorCode":null,"errorMessage":"You are not logged in - please log in with `{cli_name} login` to continue.","messagePattern":"You are not logged in - please log in with `(.+?) login` to continue\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/ai/agent_sdk/mod.rs","lineNumber":1627,"sourceCode":"fn launch_command(\n    ctx: &mut AppContext,\n    command: CliCommand,\n    global_options: GlobalOptions,\n) -> anyhow::Result<()> {\n    let parent_span = tracing::Span::current();\n    let requires_auth = command_requires_auth(&command);\n\n    if !requires_auth {\n        return dispatch_command(ctx, command, global_options);\n    }\n\n    let cli_name = warp_cli::binary_name().unwrap_or_else(|| \"warp\".to_string());\n\n    let auth_state = AuthStateProvider::handle(ctx).as_ref(ctx).get();\n    let Some(authentication) =\n        command_authentication(global_options.api_key.clone(), auth_state.is_logged_in())\n    else {\n        return Err(anyhow::anyhow!(\n            \"You are not logged in - please log in with `{cli_name} login` to continue.\"\n        ));\n    };\n\n    // On staging the warp-server is fronted by IAP, so establish an IAP token\n    // before *any* warp-server request.\n    let iap = IapManager::handle(ctx);\n    if !iap.as_ref(ctx).is_enabled() || iap.as_ref(ctx).has_valid_token() {\n        authenticate_and_dispatch(ctx, command, global_options, authentication, parent_span);\n        return Ok(());\n    }\n\n    let mut handled = false;\n    let parent_span_for_iap = parent_span.clone();\n    ctx.subscribe_to_model(&iap, move |_, event, ctx| {\n        let _guard = parent_span_for_iap.enter();\n        if handled {\n            return;","sourceCodeStart":1609,"sourceCodeEnd":1645,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/agent_sdk/mod.rs#L1609-L1645","documentation":"Raised in launch_command: the requested CLI command requires authentication (per command_requires_auth — agent, task, environment, runner, provider, model, secret, etc.), and command_authentication returned None. That means neither an explicit API key (--api-key / WARP_API_KEY) was supplied nor does AuthStateProvider report a logged-in user.","triggerScenarios":"Any auth-required command (`warp agent run`, `warp task list`, `warp whoami`, `warp runner list`, `warp model list`, ...) on a fresh install with no prior `warp login` and no WARP_API_KEY in the environment.","commonSituations":"Fresh machines or CI containers; credentials cleared by `warp logout` or cache wipe; cron/systemd contexts where the interactive login never happened and no API key is injected.","solutions":["Run `warp login` and complete the flow, then retry the command","Set a valid API key: export WARP_API_KEY=... or pass --api-key","For CI, provision an API key and inject it as an environment variable in the job"],"exampleFix":"# before\nwarp agent list   # not logged in, no key\n\n# after\nwarp login\nwarp agent list\n# or headless: WARP_API_KEY=$KEY warp agent list","handlingStrategy":"validation","validationCode":"# Fail fast with your own message before any auth-required command\nwarp whoami >/dev/null 2>&1 || { echo \"not logged in: run 'warp login' or set WARP_API_KEY\" >&2; exit 1; }\nwarp agent list","typeGuard":null,"tryCatchPattern":"out=$(cmd 2>&1) || { case \"$out\" in *'not logged in'*) warp login && cmd;; *) echo \"$out\" >&2; exit 1;; esac; }","preventionTips":["Provision WARP_API_KEY as a secret in CI instead of relying on sessions","Run `warp login` as an explicit setup step in onboarding scripts","Centralize the auth check in a wrapper so every command benefits"],"tags":["authentication","cli","setup"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}