# Troubleshoot and Fix Failed Automation Runs

> Find why a Type.com managed agent automation does not run, recover a paused schedule, and fix a failed code automation run.

Canonical page: https://docs.type.com/automations/test-troubleshoot/

Use this page when a managed agent automation does not run, or when a run fails. To test an automation before you use it, see [Test Automations](https://docs.type.com/automations/testing/index.md).

Instruction automations and code automations do different things after a failed run:

| | Scheduled instruction automation | Code automation |
| --- | --- | --- |
| When Type pauses it | After **three consecutive terminal failed runs**, or immediately when recovery requires intervention | Never because a run failed. A repair agent can pause it when further runs would do harm. |
| Notice | If Type can identify the creator and the run thread, it posts a pause notice there. The notice mentions the creator. | When most of its recent runs have failed, Type alerts its owner that it keeps failing. |
| Repair | You find and fix the cause. | Use **Fix** for an unavailable saved account. A code failure starts one repair agent, which tries to save a corrected, tested revision while the automation keeps running. |
| Resume | You select **Enable**. | A member selects **Enable** after checking the repair result or their own correction. Type never resumes it automatically. |

## Automatic retries and recovery details

One triggering occurrence is a **logical run**. Its original execution and retries are **attempts** of that same run. A retry does not create a new scheduled occurrence. Intermediate failed attempts do not count as separate failures toward the three-run pause threshold.

Type.com retries only when waiting can help, such as a rate limit or a temporary outage, and execution evidence proves that repeating the work is safe. For code automations, this requires proof that the stage's code did not start. A missing action log, a read/write label, or a repair agent's diagnosis cannot establish safe replay. A timeout after a possible write requires reconciliation or intervention.

In a code automation with several stages, each stage invocation has its own attempts and its own recovery window. A retry repeats only the stage that failed before its code started. Type never repeats a stage whose code started, and it does not run earlier stages again. While a stage waits for a retry, later events for the same automation wait behind it.

Smart is the default, with three retries after the original attempt and a 30-minute recovery window. The defaults are:

| Mode | Waits before retries 1, 2, and 3 |
| --- | --- |
| `smart` | 30 seconds, 2 minutes, 10 minutes |
| `linear` | 30, 60, 90 seconds; increases by 30 seconds each time |
| `exponential` | 30, 60, 120 seconds; doubles each time |

Each wait adds 0–10% jitter, then applies the `maxDelayMs` cap, 10 minutes by default. The default third Smart wait therefore stays at 10 minutes. A provider's Retry-After or reset time can extend the wait beyond that cap. Type never retries before that required time. If the next retry would exceed the recovery window, recovery records an exhausted outcome.

Configure retries through `runConfig.retry` on the task API or SDK, or through the agent's `create_task` and `update_task` tools:

```json
{
  "runConfig": {
    "retry": {
      "mode": "smart",
      "maxRetries": 3,
      "initialDelayMs": 30000,
      "incrementMs": 30000,
      "maxDelayMs": 600000,
      "recoveryWindowMs": 1800000
    }
  }
}
```

`maxRetries` excludes the original attempt and accepts 0–10. `initialDelayMs` controls Linear and Exponential; `incrementMs` controls Linear. Both accept 1 second to 10 minutes. `maxDelayMs` and `recoveryWindowMs` accept 1 second to 30 minutes. All modes retain the same access and replay-safety checks. Existing provider-level transport retries occur within an attempt; they do not grant a new automation retry budget.

Updating `runConfig` without a `retry` field preserves the saved retry policy. Supply `retry: {}` to restore Smart defaults, or `runConfig: null` to reset all run settings to agent defaults.

The recovery window also limits how long a live code stage can run. Each stage invocation must finish within its window, 30 minutes by default. Retries of that invocation share the same window. If the window runs out, Type stops the stage with "QuickJS execution exceeded its deadline; reconcile effects before retrying".

Disconnected or revoked accounts, missing permissions, and hard usage limits stop automatic retries. A known temporary limit can wait if its reset fits the window and replay is safe. Disabling, archiving, cancelling, or editing the automation stops stale recovery work. A pending retry keeps its budget and deadline across server restarts.

Before manually rerunning a failure, ask the agent to call `get_task` with `includeRecovery: true`. The SDK equivalent is `type.tasks.get(taskId, { includeRecovery: true })`. The response includes:

- `recovery`: the current decision, next retry time, attempt count, deadline, failure facts and replay safety.
- `recoveryDetails`: the persisted attempts, repair references and fixture results for the selected run.
- `recoveryHistory`: recent logical runs. Pass `recoveryRunId` with `includeRecovery` to inspect an older one.

Original failure evidence remains after recovery. A fresh agent conversation can use these records and the referenced repair thread to continue diagnosis. Unknown external outcomes stay explicitly uncertain; absent logs are not proof that nothing happened.

## Runs that need attention

A code automation run that stops without completing is marked **needs attention**. Type does not retry it automatically. This happens when:

- a stage fails,
- a stage returns `blocked(reason)` or `blocked(reason, output)`,
- an agent stage cannot finish, for example because the agent ends without an accepted result,
- a run reaches its limit of 64 stage invocations. Bound loops in the graph.

A `blocked` decision is not a failure. Type saves the stage result and its checkpoint, reports the reason, and keeps the automation enabled. Use `blocked` when the code finds a case that a person must handle.

## Common issues

| Issue | What to check |
| --- | --- |
| No thread was made | The trigger configuration, the enabled state, the webhook URL, app permissions, and the schedule time. Email needs an address that you create. |
| The managed agent cannot access data | The scope of the connection, the connection assignment to the Space, and expired credentials. |
| The output is too broad | Make the trigger narrower, or write clearer instructions. |
| There are too many notifications | Examine **Settings → Notifications**, thread subscriptions, and the automation instructions. |

## When an automation stops running

- **Scheduled instruction automation paused:** Three consecutive terminal failed runs pause the schedule. An unavailable account or a recovery decision requiring intervention pauses it immediately. Examine the recovery details and fix the cause. Test the automation, then enable it. See [Recover an automatically paused schedule](#recover-an-automatically-paused-schedule).
- **Code automation failing:** A failed run does not pause a code automation, so it can be on while every run fails. Use **Fix** for an unavailable saved account. If it is paused, the pause reason shows under **Needs attention**. See [Fix a failed code automation run](#fix-a-failed-code-automation-run).
- **RSS source disabled:** Five consecutive fetch errors, or one HTTP 410 response, stop polling. Fix or replace the feed, then resume it. See [Recover a disabled RSS feed](https://docs.type.com/automations/email-rss/index.md#recover-a-disabled-rss-feed).
- **Webhook rejected:** Examine the HTTP response, the JSON body, the secret, and the signature. See [webhook requests and errors](https://docs.type.com/automations/webhooks/index.md#limits-and-errors).

## Recover an automatically paused schedule

Type.com pauses a scheduled automation after **three consecutive terminal failed runs**. Retry attempts within one occurrence count as one logical run. If an unavailable saved account, missing permission, hard usage limit, or uncertain outcome requires intervention, Type pauses it immediately. If Type can identify the creator and the run thread, it posts a pause notice in that thread. The notice mentions the creator. A paused schedule does not start scheduled runs until someone enables it again.

1. Open the automation from **Automations** in the sidebar.
2. Open **Run history**. Open the failed run, and read the error and the tool results.
3. Fix the cause. For an unavailable account, select **Fix** beside it under **Needs attention** to sign in again or choose another account. See [Fix an unavailable account](https://docs.type.com/automations/managed-agent/index.md#fix-an-unavailable-account). You can also restore the execution owner’s Space access or correct the instructions or model settings.
4. Select **Save**.
5. Select **Test** to test the saved definition. The test runs as you. Also make sure that the automation creator has access before you resume the schedule.
6. Select **Enable**. In the Space automation list, the same action is **Resume task** in the menu.
7. Examine the next scheduled run in **Run history**.

> **Note:** Fixing an account, saving changes, or running a private test does not resume a paused schedule. You must select **Enable**.

## Fix a failed code automation run

A stage fails when it returns an `Err`, throws, returns a decision that does not match the graph or the schemas, goes over a limit, or when Type cannot start it. Earlier stages of the same run stay committed.

If a saved account is unavailable before a run starts, the run fails without a repair agent and Type does not replay the event. The automation stays on. Select **Fix** to sign in again or choose another account; later runs use it. See [Fix an unavailable account](https://docs.type.com/automations/managed-agent/index.md#fix-an-unavailable-account).

Temporary failures can retry when Type proves that the stage's code did not start. If those retries run out before the code starts, for example during a platform outage, the automation stays active: Type records the last attempt as a failed run and does not start a repair agent.

A code failure that retries cannot fix never pauses the automation, however many runs fail in a row. It starts one repair agent in the Space, which tries to save corrected code as a new version while the automation keeps running. While that version keeps failing, later failures use that repair. Another repair starts only after a successful run, a newly saved version, or 24 hours without a failure. A failure of a run that started on an older version starts none.

Some failures start a different repair agent, or none:

- A saved account refused a request during the run. A repair agent checks what it can change and tells the owner which account to reconnect. Select **Fix**.
- The run failed after it may already have written to another app, so repeating it could repeat that write (for example, "Provider progress may include external tools"). Type fails that run, does not replay it, and starts no repair agent. Later events still run, so reconcile those writes.

### What happens after a failure

1. Type records the failure. The automation keeps running.
2. When most of its recent runs have failed, Type alerts the owner that it keeps failing. An alert is not guaranteed, so check the automation's runs under **Automations** instead of waiting for one.
3. For a code failure, the repair agent reads the failure and tries to save corrected code with a fixture that reproduces the failure. In its repair thread, it reports its diagnosis, any change it saved, and any writes you must check. If it cannot fix the failure, it leaves the automation running and reports what it found. It asks for human help, which pauses the automation, only when further runs would do harm.
4. Type never replays the failed run. If the automation is paused, the pause reason shows under **Needs attention**: check the repair result, reconcile any writes, and then select **Enable**.

A pause that a repair agent requests stops runs in progress at their next stage. When you pause an automation yourself, choose **Pause and stop** to stop runs in progress right away, including agent turns already running, or let them finish.

### Reconcile before verification

A failed run may already have written to another app. Type does not undo those writes.

1. Read the failed run's history and identify every attempted write.
2. Check the destinations to determine which writes completed.
3. Make the corrected code skip or update completed work. Use provider idempotency keys where available. See [Write Safely](https://docs.type.com/automations/safe-writes/index.md).
4. Pause the automation yourself if later runs could repeat a write whose outcome is still uncertain.

`failurePolicy` accepts only `"pause"`, a name kept from when failures paused the automation. A failed run no longer pauses it, and a code failure starts a repair agent.

### Find the cause

Read the run history:

```sh
type-cli automations history --space <space> --automation <automation-id> --status failed
type-cli automations history --space <space> --run <run-id> --include-activity
```

`console.log` and the other console methods do nothing in automation code. To see values, use `complete()` and [action logs](https://docs.type.com/automations/reference/context/index.md#ctxaction-and-ctxmutativeaction). Write clear error messages in `err(...)`. Type saves the message with the failed run.

### Common causes

| Error | Cause | Fix |
| --- | --- | --- |
| `Invalid subscription event: ...` | The event does not match the schema of the subscription. | Make the schema accept the real provider data. Use `z.looseObject()` and `.nullish()`. |
| `Invalid input for destination stage <stage>: ...` | A stage returned `next()` with data that the destination's `input` schema rejects. | Make the data match the schema. TypeScript checks the shape, not limits such as `.min(1)`. |
| `Code stage <stage> must return next(), complete(), or blocked(): ...` | The stage returned something else, for example `undefined`. | Return a decision on every path. |
| `Invalid automation output: ...` | A `complete()` or `blocked()` value does not match the root `output` schema. | Change the value or the schema. |
| `QuickJS API request budget exceeded` | More than 128 requests in one stage, or more than 8 at the same time. | Ask for fewer, larger pages. Make fewer calls at the same time. |
| `Type API response exceeds the QuickJS 2 MiB limit; paginate the request` | A response was too large. | Ask for smaller pages. |
| `QuickJS result exceeds the 2 MiB combined limit for checkpoint, output, visualization and receipts (... bytes)` | The checkpoint, output, visualization, and transition data of one stage are larger than 2 MiB together. | Return less data. Store large datasets in another place. |
| `QuickJS execution exceeded its deadline; reconcile effects before retrying` | The stage ran past its recovery window, 30 minutes by default. | Do less work in each stage. Save progress in a checkpoint. |
| `A previous automation run was interrupted; its side effects were not replayed` | Type stopped a run before it finished, for example during a server restart. | Check if the run made changes. Then resume. |

For more messages, see [Errors](https://docs.type.com/automations/reference/errors/index.md).

### Fix it yourself

Correct the failed stage and test the same input before you save the corrected code.

1. Change the code. Add a fixture that causes the same failure. For a later stage, set the fixture's `stage`; see [What a fixture runs](https://docs.type.com/automations/testing/index.md#what-a-fixture-runs).
2. Test the corrected code. Ask Type in the Space to update the automation's code: Type tests the draft with `test_automation_code` before it saves it.
3. Save the corrected code. Type saves it with `update_task`. Saving does not turn the automation on or off: an automation that is on runs the corrected code from its next event, and a paused automation stays paused. You can test the saved code again: `type-cli automations test-code <automation-id> --space <space> --arguments-file ./fixture.json --json`.
4. Reconcile the failed run's writes. If the automation is paused, then select **Enable**, or run `type-cli scheduled-actions enable <automation-id> --space <space>`.

A failed run does not pause the automation, so most failures need no **Enable** step. The automation is paused only if a repair agent asked for human help, a member paused it, or it was paused before failures stopped pausing automations. While a request for human help is unresolved, `type-cli automations deploy` rejects the folder with "A member must resolve this automation's request for human intervention before redeploying". Only a member can enable the automation, and enabling resolves the request. After that, a deploy replaces the code of the enabled automation.

> **Caution:** Check if the failed run made changes before you save corrected code for an automation that is on, or resume a paused one. A run can fail after a write. Type does not undo the write. See [Reconcile before verification](#reconcile-before-verification).

### Interrupted runs

If a server restarts while a safe retry is pending, Type restores its saved due time, budget and original occurrence. If code had already started and its outcome is uncertain, Type does not blindly replay it. Inspect the recovery record and check the destination before further action. Completed receipts and checkpoints remain authoritative across restarts.

### Events during a pause

- Type does not save new events for the automation while it is paused.
- Events that Type saved before the pause wait. They run after the automation resumes, if the code still subscribes to their event type.
- A schedule does not run missed ticks. It continues at its next planned time.

## Review reliability and performance

Ask the Type agent to inspect `get_task({ taskId, includeRecovery: true })` when investigating a failed or slow automation or comparing runs after a change. The response includes a `reliability` report. You can also read it through the SDK with `type.tasks.get(taskId, { includeRecovery: true })`, the CLI with `type-cli automations get <taskId> --kind scheduled --json`, or REST with `GET /api/agents/:agentId/tasks/:taskId?includeRecovery=true`. The separate hosted Type MCP connection used by Claude Cowork does not expose this report.

The report groups all required code and agent stages into one occurrence. Each stage shows its name, kind, pinned revision, state, known attempts and errors. It distinguishes an agent still working, a human question awaiting an answer, and an accepted result waiting for the next code stage. An agent stage completes when its result is accepted. The whole occurrence completes when the final stage and root report complete.

Timing separates stage execution, human wait, continuation queue delay, planned retry waits and late retry starts. Missing timing evidence returns null. For example, a 55-second occurrence might contain 20 seconds of execution, 30 seconds of backoff, and a five-second delay before the retry started. The report also includes failure groups, notice references, and repair verification references for automations that support repair.

Check `coverage` and `attemptEvidenceComplete` first. The report selects the most recent 100 recorded root occurrences and examines up to 2,000 linked execution journals. Human-answer resumptions can finish without a recovery journal: accepted results can prove completion, but cannot prove first-attempt success. Such runs have outcome `completed` and are excluded from the first-attempt denominator. Older records, missing required stages, and incomplete histories remain explicit gaps. Rates are not a complete history or an SLA. A linked notice proves that Type created a message, not that someone read it.

To improve an automation, ask the agent to identify a specific issue, preserve the original failure as a fixture, and compare the old and proposed revisions on representative cases. Use the existing safe verification flow before resuming. Runtime success does not prove answer accuracy or successful delivery: those require expected results, confirmed destination records, or independent review. The report also does not yet attribute usage cost to individual retry and repair attempts.

## Keep a feedback thread

If an automation gives a weak result, change the instructions near that example. The best automation instructions usually come from real event payloads and real review feedback.
