# agent loop detected retrying failed pdf export: how to fix it

An agent retrying a failed PDF export in a loop needs to stop and diagnose instead of re-running the same failing export. Cap export attempts, surface the underlying error, and fix that. Identical retries of a deterministic failure never succeed.

```text
agent loop detected retrying failed pdf export
```

## When to use this skill
- An agent loops retrying a failed export
- Logs show identical export attempts

## When not to use this skill
- Exports fail differently each time (a flaky renderer)
- Manual exports also fail (a platform issue)

## Tool compatibility
Agent document export with retry logic.
Related area: agent frameworks and agent runtime tooling.
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 an agent loops retrying a failed export, start at step 1 below.
- If instead exports fail differently each time (a flaky renderer), 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. Cap export attempts

```
Allow at most three export tries per run.
```
Expected: the agent stops instead of looping.

### 2. Surface the real error

```
Capture and log the full export failure message.
```
Expected: a diagnosable cause instead of a generic retry.

### 3. Fix the underlying issue

```
Address the named cause, like a bad element or template problem.
```
Expected: the export can actually succeed.

### 4. Retry once after the fix

```
Run the export a single time.
```
Expected: a successful PDF.

## Confirm each step worked
Run through this checklist before moving on. If a check fails, redo that step instead of pushing ahead.
- Step 1 (cap export attempts): Expected: the agent stops instead of looping.
- Step 2 (surface the real error): Expected: a diagnosable cause instead of a generic retry.
- Step 3 (fix the underlying issue): Expected: the export can actually succeed.
- Step 4 (retry once after the fix): Expected: a successful PDF.

## Quick recap
1. Cap export attempts
2. Surface the real error
3. Fix the underlying issue
4. Retry once after the fix

## 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
### agent retrying failed pdf export
Cap attempts and diagnose. If this matches what you saw, the steps above apply as written.

### pdf export retry loop
Deterministic failures need fixes, not retries. If this matches what you saw, the steps above apply as written.

## Why it happens
Export failures are usually deterministic: the same content fails the same way every time. A retry loop without diagnosis just burns time re-proving the failure, while the real error sits unread in the logs.

## Edge cases
- Distinguish transient from deterministic failures before retrying
- Export a minimal test document to check renderer health
- Alert a human when the cap hits, dont silently give up

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst__vsKm-RntT74nmgRlX0oOA
