Skip to content

Continue as New and Terminals

A Dart workflow starts at execute and ends by returning a result, throwing a permanent failure, cancelling, or calling continueAsNew. JSON documents use end and continueAsNew steps.

Terminal Statuses

StatusMeaning
completedReturned a result
failedPermanent failure after retries or an unhandled error
cancelledOperator or business cancellation
continuedAsNewParent closed; successor holds the next history

Cancel and fail are first-class terminals. They reach pending work and attached spawned runs.

Continue as New

Histories are bounded. WorkflowRuntimeOptions suggests continue-as-new at a soft limit (continueAsNewSuggestedAt, default 10,000 events) and fails at the hard bound (maxHistoryEvents, default 50,000).

dart
if (workflow.continueAsNewSuggested) {
  workflow.continueAsNew({...input, 'generation': generation + 1});
}

The parent close, successor creation, lineage links, and successor workflowStarted event are one storage transaction. Lineage is acyclic. Commands addressed to an older generation resolve the active successor.

See Also