# loopio export died when auth token expired mid run: how to fix it

Long exports outlive the access token, and a refresh that only happens on failure comes too late. Refresh the token before starting, and re-authenticate cleanly on the first 401 instead of retrying with the dead token.

```text
loopio export died when auth token expired mid run
```

## When to use this skill
- Export fails partway with an auth error
- Token works at the start but dies mid-export

## When not to use this skill
- Export fails immediately (a credentials issue)
- Export completes but data is wrong (a data issue)

## Tool compatibility
Agent Loopio token refresh. Related area: authentication and identity.

Related area: proposal automation and agent-assisted RFP workflows.

Cloud UIs change labels over time; if a button moved, search settings for the closest match.

## Before you start
- Sign in to the tool and keep one tab open so sessions stay clean
- Copy the exact error text and note the time it happened
- Set aside 15 to 20 minutes; most of these resolve in a single pass

## Quick diagnosis
Make sure this is the right skill before you invest the 15 minutes.
- If you are dealing with export fails partway with an auth error, start at step 1 below.
- If instead export fails immediately (a credentials issue), stop here; you need a different skill.
- If neither quite matches, compare your screen against the verbatim error block at the top; that block is exactly what this skill covers.

## Fix it in steps
### 1. Refresh the token before the export

```
Obtain a fresh access token right before starting.
```
Expected: Expected: token issued with a full lifetime.

### 2. Start the export immediately

```
Begin the export right after the refresh.
```
Expected: Expected: export runs under the fresh token.

### 3. Re-authenticate on first 401

```
On the first auth error, fetch a new token and retry once.
```
Expected: Expected: single clean retry, not a loop.

### 4. Verify the export completed

```
Check the exported file for completeness.
```
Expected: Expected: full library exported.

## Confirm each step worked
Run through this checklist before moving on. If a check fails, redo that step instead of pushing ahead.
- Step 1 (refresh the token before the export): Expected: expected: token issued with a full lifetime.
- Step 2 (start the export immediately): Expected: expected: export runs under the fresh token.
- Step 3 (re-authenticate on first 401): Expected: expected: single clean retry, not a loop.
- Step 4 (verify the export completed): Expected: expected: full library exported.

## Quick recap
1. Refresh the token before the export
2. Start the export immediately
3. Re-authenticate on first 401
4. Verify the export completed

## Still stuck?
Gather three things: the exact error text, the time it happened, and what changed just before it broke.
Check the vendor status page for an active incident. Then open a support ticket with those three things;
it cuts the back-and-forth in half. For agent runs, attach the last 50 lines of the agent log too,
since the loop or timeout signature in the log usually names the cause.

## Variant phrasings
### loopio token expired export
Proactive refresh fixes it. If this matches what you saw, the steps above apply as written.

### agent loopio export auth failed
Re-auth once on 401. If this matches what you saw, the steps above apply as written.

## Why it happens
Access tokens have fixed lifetimes that long exports exceed, and retrying with the expired token just repeats the 401. Refreshing up front and handling the first 401 cleanly covers both cases.

## Edge cases
- Do not loop retries on 401; one re-auth then one retry is the pattern
- Log token issue time so expiry is predictable
- Chunked exports shorten each authenticated session

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_kPnb8tK7s3yBIyvUEEdLKQ
