---
title: "MGS9018: token lifetime outside its bound"
description: A stored token or a share link was asked to live for longer than its maximum, for no time at all, or forever. It is refused, never shortened to fit.
tags: [MGS9018, auth, token, share, expiry, lifetime, "400"]
---

# MGS9018: token lifetime outside its bound

A mint asked for a lifetime the token cannot have. Every token magus mints
expires, within a bound set by what it is:

| Token                                             | Bound                                      |
| ------------------------------------------------- | ------------------------------------------ |
| stored token (`mgs_`: connector, console, viewer) | more than 0, at most 366 days (default 90) |
| share link (`mgl_`)                               | 1 minute to 24 hours (default 15 minutes)  |

```text
[MGS9018] invalid --expires "never": a token must expire, more than 0 and at
most 366d out
  see: .../MGS9018.md
```

The same refusal comes from `magus config mcp connector create`,
`magus config console token create`, the console's token settings (`400`), and
a share request (`400`).

## Why

A request past the bound is refused rather than shortened, so the token you get
always lives exactly as long as you asked. A token that never expires is a
standing credential for whoever finds it; a share link travels over plaintext
HTTP on the LAN, so it lives a day at most.

## Resolution

Ask for a lifetime inside the bound: `--expires 366d` is the longest a stored
token lives, and a display that must stay up longer than a day gets a new share
link each day. `magus doctor` names a stored token 14 days before it expires,
and an expired one is removed the next time the store is read.

## See also

- [Tokens and grants](../../../concepts/tokens.md)
