Incorrect token
FATA[12:00:00] Failed to get connection settings: Incorrect token
Code: Unauthorized
Request ID: 5c1e8a04f7b29d63e0a4b718c92f5d3e
When a tunnel starts, the same cause more often looks like this:
FATA[12:00:00] Unknown token
Code: AuthorizationRequired
Request ID: 9a3f61d0c4e82b57f1d06a9e3c7b4208
tuna CLI and Tuna Desktop show this error when a tunnel starts with an API key or a legacy token. The client doesn't reconnect and exits right away. A background service appends the token was revoked or does not exist, reinstall the service with a valid token to the message and doesn't restart.
Causeโ
The server couldn't find the key you passed. Usually this means that:
- the key has a typo, or part of it was lost when copying;
- the variable or flag got the wrong value, for example an empty string from an unset CI secret;
- the account or team that owned the key was deleted.
The server recognizes a key that was deleted or has expired and responds with a different error โ Token expired.
What to doโ
- Check where the CLI takes the key from. For tunnels, it checks the sources in this order: the
--api-keyflag, theTUNA_TOKENvariable, the saved session, theTUNA_API_KEYvariable, the config file. An oldTUNA_TOKENleft in the environment overrides eventuna login. - Compare the key with the list of API keys in the dashboard. If the key isn't there, create a new one with the Run tunnels permission.
- Update the key wherever it's stored: in CI secrets, the
TUNA_API_KEYvariable, or the config file viatuna login --with-api-key. - Your own computer doesn't need a key: remove it from the environment and log in with
tuna login. - Reinstall the service with the new key โ see Running in the background.
If the key is correct but the error persists, contact support and include the Request ID.