# plan.resume

> For the complete documentation index, see [llms.txt](https://ensforge.com/llms.txt).

Continues a saved plan after a failure or a reload. Parameters, return value, errors and examples for plan.resume in @ensforge/sdk.

Source: https://ensforge.com/docs/reference/sdk/plan/resume

<ApiMeta kind="Signs" stability="stable" since="1.0.0" source="packages/sdk/src/actions/plan/resume/index.ts#L61" />

Continues a saved plan after a failure or a reload. Resolves once the remaining transactions
are submitted.

## When to use [#when-to-use]

Use when a registration, migration or other multi-step write stopped part-way. Use
[`resumeSync`](/docs/reference/sdk/plan/resume#wait-for-the-receipt-with-resumesync) to wait for the receipts.

## Details [#details]

- Steps submitted before are confirmed, not sent again; a dropped transaction or a failed
  bundle is sent again.
- Each remaining step is simulated against current state right before it is sent.
- The plan id is `result.plan.id`, or `context.planId` on a write's error.
- A plan for another chain (an L2 primary name) resumes on that chain's clients from the
  client's `chains`.

<Callout type="warn" title="Gotchas">
- Plans live in the client's `storage`: pass `Plan.localStorage()` to survive page reloads.
</Callout>

## Signature [#signature]

```ts
function resume(
  client: Like,
  options: resume.Options & Write.Options,
): Promise<resume.ReturnType>
```

Call it as `ens.plan.resume(options)` on a client, or `Actions.plan.resume(client, options)`.

## Parameters [#parameters]

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `id` (required) | `string` |  | Plan id. |

## Returns [#returns]

Resolves to `Write.Result`. Submitted transaction hashes (earlier steps included) and the plan.

| Field | Type | Description |
| --- | --- | --- |
| `hash` | `Hex` | Hash of the last transaction. |
| `hashes` | `readonly Hex[]` | Every submitted transaction, in order. |
| `id` | `string` | EIP-5792 bundle id when the calls were sent as one batch. |
| `plan` | `Plan` | The plan the write executed: its steps, in order, as they were submitted. |

## Errors [#errors]

| Error | Codes | When |
| --- | --- | --- |
| [`NotFoundError`](/docs/reference/errors/not-found-error) | [`PLAN_NOT_FOUND`](/docs/reference/errors/PLAN_NOT_FOUND) | an unknown plan. |
| [`PlanError`](/docs/reference/errors/plan-error) | [`PLAN_CHAIN_MISMATCH`](/docs/reference/errors/PLAN_CHAIN_MISMATCH), [`PLAN_ACCOUNT_MISMATCH`](/docs/reference/errors/PLAN_ACCOUNT_MISMATCH), [`PLAN_ROUTE_REQUIRED`](/docs/reference/errors/PLAN_ROUTE_REQUIRED) | the plan cannot continue here. |
| [`PlanError`](/docs/reference/errors/plan-error) | [`PLAN_INVALID`](/docs/reference/errors/PLAN_INVALID) | a saved plan cannot be read. |
| [`ContractRevertError`](/docs/reference/errors/contract-revert-error) | [`CONTRACT_REVERTED`](/docs/reference/errors/CONTRACT_REVERTED) | , or the failing step's own error (`Errors.AnyError`: a plan can hold any step), with `context.planId` and `context.step`. |

It can also fail with the errors every write can (`Errors.WriteError`: the common errors plus `InsufficientFundsError`, `TransactionError`, `UnsupportedError`, `UserRejectedError`, `WalletError`).

See [How errors work](/docs/sdk/errors-explained).

## Examples [#examples]

<Tabs groupId="api" items={["Client","Standalone","Effect"]} persist>
<Tab>
```ts title="Resuming after a failure"
const { hash } = await ens.plan.resume({ id: planId })
```
</Tab>

<Tab>
```ts title="Resuming with a standalone call"
import { Actions } from "@ensforge/sdk"

await Actions.plan.resume(ens, { id })
```
</Tab>

<Tab>
```ts title="Resuming in an Effect program"
import { Actions } from "@ensforge/sdk/effect"

yield* Actions.plan.resume(ens, { id })
```
</Tab>
</Tabs>

## Wait for the receipt with `resumeSync` [#wait-for-the-receipt-with-resumesync]

Continues a saved plan and resolves once every receipt is in.

Use when the next step depends on the plan being finished on-chain.

`plan.resumeSync` takes the same options plus [`confirmations` and `timeout`](/docs/reference/sdk/client#sync-options).

Resolves to `Write.SyncResult`. Receipts plus the submitted hashes and plan.

<Tabs groupId="api" items={["Client","Standalone","Effect"]} persist>
<Tab>
```ts title="Resuming and waiting"
const { receipts } = await ens.plan.resumeSync({ id })
```
</Tab>

<Tab>
```ts title="Waiting with a standalone call"
import { Actions } from "@ensforge/sdk"

await Actions.plan.resumeSync(ens, { id })
```
</Tab>

<Tab>
```ts title="Waiting in an Effect program"
import { Actions } from "@ensforge/sdk/effect"

yield* Actions.plan.resumeSync(ens, { id })
```
</Tab>
</Tabs>

## See also [#see-also]

- [`plan.get`](/docs/reference/sdk/plan/get) to read its progress first