Skip to content

API reference > @kontsedal/olas-core > MutationDisposedError

MutationDisposedError class ​

Rejection from mutation.run(...) when the mutation was already disposed — the owning controller is gone, so mutate was never called and **the write did not happen**.

Deliberately NOT an AbortError. Every other cancellation in this library is one, and isAbortError(err) is the documented way to filter them — which is exactly why an abort is the wrong shape here. A superseded or reset run is work the app *chose* to drop; a run against a disposed mutation is work the app asked for and silently did not get, and a blanket abort filter would hide that lost write.

Reaching this usually means a callback outlived its controller — a confirm dialog answered after the panel behind it closed, a retry button in a toast that outlives the view. Two fixes, in order of preference:

  1. Own the mutation somewhere that lives as long as the interaction does. 2. createMutation(ctx, { detached: true }) — runs then survive dispose, and this error is never thrown. SPEC §6.5.

Signature:

typescript
declare class MutationDisposedError extends Error

Extends: Error

Constructors ​

Constructor

Modifiers

Description

(constructor)(mutationId, controllerPath)

Constructs a new instance of the MutationDisposedError class

Properties ​

Property

Modifiers

Type

Description

controllerPath

readonly

readonly string[]

Path of the controller that owned the mutation.

mutationId

readonly

string | undefined

The mutation's id, when it has one.

Released under the MIT License.