> Markdown version of https://tuna.am/en/docs/troubleshooting/errors/session-expired-or-revoked/. Documentation index: [llms.txt](https://tuna.am/en/llms.txt), full text in one file: [llms-full.txt](https://tuna.am/en/llms-full.txt). Any page is available as Markdown: append `.md` to its URL without the trailing slash.

# session expired or revoked, run `tuna login`

```text
FATA[12:00:00] session expired or revoked, run `tuna login`

```

tuna CLI prints this error when it's signed in with a session (`tuna login`). At startup, the command exits right away. If the session ends while a tunnel is running, the CLI first warns:

```text
WARN[12:00:00] Session expired or revoked, run `tuna login` to sign in again

```

The tunnel exits on the next reconnect with ``Failed to get connection settings: session expired or revoked, run `tuna login` ``. If the session was terminated in the profile, the device's tunnels stop immediately:

```text
FATA[12:00:00] Login session was ended, run `tuna login` to sign in again

```

## Cause

The server no longer accepts this device's session. This happens when:

* the device hasn't used the session for 30 days. A running tunnel extends the session by itself, so this is usually a machine where tuna hasn't run for a while;
* the session was terminated in the [profile](https://my.tuna.am/profile?lang=en) or with `tuna logout`;
* the session file or keyring entry was copied to another machine, and both machines refreshed the session. The server accepts each refresh token only once and treats reuse of an old one as a leak, so it terminates the whole session;
* you were removed from the team you signed in to.

The CLI deletes a dead session, so the next run may show [Not logged in](https://tuna.am/en/docs/troubleshooting/errors/not-logged-in.md).

## What to do

1. Log in again:

   ```shell
   tuna login

   ```

   On a server without a browser, use `tuna login --no-browser`.

2. Restart the tunnels that exited.

3. If the session keeps ending, check the session list in your [profile](https://my.tuna.am/profile?lang=en) and in `tuna session list`: one session may be in use on several machines. Log in on each machine separately.

4. For servers, CI, and tunnels that must run unattended, use an [API key](https://my.tuna.am/api_keys?lang=en) or a [background service](https://tuna.am/en/docs/tunnels/guides/service.md): they don't need a session.

Learn more about sessions in [Sessions and API keys](https://tuna.am/en/docs/guides/sessions-and-api-keys.md).
