Crux
Errors

EFFECT_SCOPE_NOT_FOUND

An effect rollback scope reference is missing, malformed, or unavailable.

What failed

rollback() received a value that is not a valid EffectScopeRef, or neither the process ledger nor a configured Runtime Effects store could match its id and runId.

This code is also used when a scope ref is passed to receipt-only recovery.

Fix

Use the exact boundary.ref returned inside rollbackOnError():

const scope = await rollbackOnError(async (boundary) => {
  await updateCustomer(input);
  return boundary.ref;
});

await rollback(scope);

Do not construct, edit, or mix scope refs from different runs. Without a Runtime store, scopes are process-local. With a store, the same ref can reconstruct after restart when the durable scope row still exists.

See Roll back a boundary later and Durability and restarts.

On this page