Skip to content

@temporal-contract/worker


@temporal-contract/worker / workflow

workflow ​

Classes ​

ActivityCancelledError ​

Defined in: packages/worker/src/errors.ts:287

Discriminated variant surfaced when a call to an errors-declaring activity was cancelled (the workflow itself, or an enclosing cancellation scope). Detected via @temporalio/workflow's isCancellation(...).

A sibling of ActivityError rather than a subclass, for the same reason ChildWorkflowCancelledError is a sibling of ChildWorkflowError: call sites discriminate on the _tag.

Extends ​

  • TaggedErrorInstance<"@temporal-contract/ActivityCancelledError", { activityName: string; cause?: unknown; }>

Constructors ​

Constructor ​
ts
new ActivityCancelledError(activityName, cause?): ActivityCancelledError;

Defined in: packages/worker/src/errors.ts:294

Parameters ​
ParameterType
activityNamestring
cause?unknown
Returns ​

ActivityCancelledError

Overrides ​
ts
TaggedError(
  "@temporal-contract/ActivityCancelledError",
  { name: "ActivityCancelledError" },
)<{
  activityName: string;
  cause?: unknown;
}>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/ActivityCancelledError"TaggedError( "@temporal-contract/ActivityCancelledError", { name: "ActivityCancelledError" }, )._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
activityNamereadonlystringTaggedError( "@temporal-contract/ActivityCancelledError", { name: "ActivityCancelledError" }, ).activityNamepackages/worker/src/errors.ts:291
cause?publicunknownActivityDefinitionNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTaggedError( "@temporal-contract/ActivityCancelledError", { name: "ActivityCancelledError" }, ).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError( "@temporal-contract/ActivityCancelledError", { name: "ActivityCancelledError" }, ).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError( "@temporal-contract/ActivityCancelledError", { name: "ActivityCancelledError" }, ).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

ActivityError ​

Defined in: packages/worker/src/errors.ts:266

Generic error surfaced on the Err(...) branch when an activity that declares contract errors fails for a reason other than one of its declared errors — retries exhausted on a technical failure, a timeout, an undeclared ApplicationFailure type, or a validation failure at the workflow → activity boundary.

Mirrors ChildWorkflowError: cause is the unwrapped actionable failure (Temporal's ActivityFailure wrapper is seen through), so callers can branch on the failure category in one step.

Only activities that declare an errors map surface this — activities without declared errors keep Temporal's native throwing behavior.

Extends ​

  • TaggedErrorInstance<"@temporal-contract/ActivityError", { activityName: string; cause?: unknown; }>

Constructors ​

Constructor ​
ts
new ActivityError(
   activityName, 
   message, 
   cause?): ActivityError;

Defined in: packages/worker/src/errors.ts:272

Parameters ​
ParameterType
activityNamestring
messagestring
cause?unknown
Returns ​

ActivityError

Overrides ​
ts
TaggedError("@temporal-contract/ActivityError", {
  name: "ActivityError",
})<{
  activityName: string;
  cause?: unknown;
}>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/ActivityError"TaggedError("@temporal-contract/ActivityError", { name: "ActivityError", })._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
activityNamereadonlystringTaggedError("@temporal-contract/ActivityError", { name: "ActivityError", }).activityNamepackages/worker/src/errors.ts:269
cause?publicunknownActivityDefinitionNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTaggedError("@temporal-contract/ActivityError", { name: "ActivityError", }).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("@temporal-contract/ActivityError", { name: "ActivityError", }).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError("@temporal-contract/ActivityError", { name: "ActivityError", }).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

ChildWorkflowCancelledError ​

Defined in: packages/worker/src/errors.ts:352

Discriminated variant surfaced when a child workflow operation (start, execute, or wait-for-result) was cancelled — either because the parent workflow itself was cancelled, the child was explicitly cancelled, or its enclosing cancellation scope was. Detected via @temporalio/workflow's isCancellation(...), which sees through nested ChildWorkflowFailure / CancelledFailure chains.

A sibling of ChildWorkflowError rather than a subclass: both are distinct TaggedErrors, so call sites discriminate on the _tag (or instanceof ChildWorkflowCancelledError) instead of relying on an instanceof ChildWorkflowError that also matches cancellation. matchTags folds the ChildWorkflowError | ChildWorkflowCancelledError union exhaustively.

Extends ​

  • TaggedErrorInstance<"@temporal-contract/ChildWorkflowCancelledError", { cause?: unknown; workflowName: string; }>

Constructors ​

Constructor ​
ts
new ChildWorkflowCancelledError(workflowName, cause?): ChildWorkflowCancelledError;

Defined in: packages/worker/src/errors.ts:359

Parameters ​
ParameterType
workflowNamestring
cause?unknown
Returns ​

ChildWorkflowCancelledError

Overrides ​
ts
TaggedError(
  "@temporal-contract/ChildWorkflowCancelledError",
  { name: "ChildWorkflowCancelledError" },
)<{
  workflowName: string;
  cause?: unknown;
}>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/ChildWorkflowCancelledError"TaggedError( "@temporal-contract/ChildWorkflowCancelledError", { name: "ChildWorkflowCancelledError" }, )._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicunknownActivityDefinitionNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTaggedError( "@temporal-contract/ChildWorkflowCancelledError", { name: "ChildWorkflowCancelledError" }, ).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError( "@temporal-contract/ChildWorkflowCancelledError", { name: "ChildWorkflowCancelledError" }, ).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError( "@temporal-contract/ChildWorkflowCancelledError", { name: "ChildWorkflowCancelledError" }, ).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
workflowNamereadonlystringTaggedError( "@temporal-contract/ChildWorkflowCancelledError", { name: "ChildWorkflowCancelledError" }, ).workflowNamepackages/worker/src/errors.ts:356

ChildWorkflowError ​

Defined in: packages/worker/src/errors.ts:326

Generic error for child workflow operations.

When the child execution itself fails (Temporal's ChildWorkflowFailure), cause is set to the unwrapped underlying failure (ApplicationFailure, TimeoutFailure, TerminatedFailure, etc.) lifted from Temporal's wrapper — mirroring the client-side WorkflowFailedError.cause behavior, so callers can branch on the failure category in one step instead of unwrapping twice.

Extends ​

  • TaggedErrorInstance<"@temporal-contract/ChildWorkflowError", { cause?: unknown; }>

Constructors ​

Constructor ​
ts
new ChildWorkflowError(message, cause?): ChildWorkflowError;

Defined in: packages/worker/src/errors.ts:331

Parameters ​
ParameterType
messagestring
cause?unknown
Returns ​

ChildWorkflowError

Overrides ​
ts
TaggedError("@temporal-contract/ChildWorkflowError", {
  name: "ChildWorkflowError",
})<{
  cause?: unknown;
}>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/ChildWorkflowError"TaggedError("@temporal-contract/ChildWorkflowError", { name: "ChildWorkflowError", })._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicunknownActivityDefinitionNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTaggedError("@temporal-contract/ChildWorkflowError", { name: "ChildWorkflowError", }).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("@temporal-contract/ChildWorkflowError", { name: "ChildWorkflowError", }).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError("@temporal-contract/ChildWorkflowError", { name: "ChildWorkflowError", }).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

ChildWorkflowNotFoundError ​

Defined in: packages/worker/src/errors.ts:303

Error thrown when a child workflow is not found in the contract

Extends ​

  • TaggedErrorInstance<"@temporal-contract/ChildWorkflowNotFoundError", { availableWorkflows: readonly string[]; workflowName: string; }>

Constructors ​

Constructor ​
ts
new ChildWorkflowNotFoundError(workflowName, availableWorkflows?): ChildWorkflowNotFoundError;

Defined in: packages/worker/src/errors.ts:310

Parameters ​
ParameterTypeDefault value
workflowNamestringundefined
availableWorkflowsreadonly string[][]
Returns ​

ChildWorkflowNotFoundError

Overrides ​
ts
TaggedError(
  "@temporal-contract/ChildWorkflowNotFoundError",
  { name: "ChildWorkflowNotFoundError" },
)<{
  workflowName: string;
  availableWorkflows: readonly string[];
}>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/ChildWorkflowNotFoundError"TaggedError( "@temporal-contract/ChildWorkflowNotFoundError", { name: "ChildWorkflowNotFoundError" }, )._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
availableWorkflowsreadonlyreadonly string[]TaggedError( "@temporal-contract/ChildWorkflowNotFoundError", { name: "ChildWorkflowNotFoundError" }, ).availableWorkflowspackages/worker/src/errors.ts:308
cause?publicunknownTaggedError( "@temporal-contract/ChildWorkflowNotFoundError", { name: "ChildWorkflowNotFoundError" }, ).causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTaggedError( "@temporal-contract/ChildWorkflowNotFoundError", { name: "ChildWorkflowNotFoundError" }, ).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError( "@temporal-contract/ChildWorkflowNotFoundError", { name: "ChildWorkflowNotFoundError" }, ).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError( "@temporal-contract/ChildWorkflowNotFoundError", { name: "ChildWorkflowNotFoundError" }, ).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
workflowNamereadonlystringTaggedError( "@temporal-contract/ChildWorkflowNotFoundError", { name: "ChildWorkflowNotFoundError" }, ).workflowNamepackages/worker/src/errors.ts:307

QueryInputValidationError ​

Defined in: packages/worker/src/errors.ts:166

Error thrown when query input validation fails

Extends ​

Constructors ​

Constructor ​
ts
new QueryInputValidationError(queryName, issues): QueryInputValidationError;

Defined in: packages/worker/src/errors.ts:167

Parameters ​
ParameterType
queryNamestring
issuesreadonly Issue[]
Returns ​

QueryInputValidationError

Overrides ​
ts
ValidationError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
category?readonly"BENIGN" | null-ValidationError.categorynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:113
cause?readonlyError-ValidationError.causenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:72
details?readonlyunknown[] | null-ValidationError.detailsnode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:111
failure?publicIFailureThe original failure that constructed this error. Only present if this error was generated from an external operation.ValidationError.failurenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:78
issuesreadonlyreadonly Issue[]-ValidationError.issuespackages/worker/src/errors.ts:38
messagepublicstring-ValidationError.messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstring-ValidationError.namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
nextRetryDelay?readonlyany-ValidationError.nextRetryDelaynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:112
nonRetryable?readonlyboolean | null-ValidationError.nonRetryablenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:110
queryNamereadonlystring--packages/worker/src/errors.ts:168
stack?publicstring-ValidationError.stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
type?readonlystring | null-ValidationError.typenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:109
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.ValidationError.stackTraceLimitnode_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:68

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType
targetObjectobject
constructorOpt?Function
Returns ​

void

Inherited from ​

ValidationError.captureStackTrace

create() ​
ts
static create(options): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:130

Create a new ApplicationFailure.

By default, will be retryable (unless its type is included in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterType
optionsApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.create

fromError() ​
ts
static fromError(error, overrides?): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:124

Create a new ApplicationFailure from an Error object.

First calls ensureApplicationFailure | `ensureApplicationFailure(error)` and then overrides any fields provided in overrides.

Parameters ​
ParameterType
errorunknown
overrides?ApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.fromError

nonRetryable() ​
ts
static nonRetryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:150

Get a new ApplicationFailure with the nonRetryable flag set to true.

When thrown from an Activity or Workflow, the Activity or Workflow will not be retried (even if type is not listed in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.nonRetryable

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType
errError
stackTracesCallSite[]
Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

ValidationError.prepareStackTrace

retryable() ​
ts
static retryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:139

Get a new ApplicationFailure with the nonRetryable flag set to false. Note that this error will still not be retried if its type is included in RetryPolicy.nonRetryableErrorTypes.

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type (used by RetryPolicy.nonRetryableErrorTypes)
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.retryable


QueryOutputValidationError ​

Defined in: packages/worker/src/errors.ts:183

Error thrown when query output validation fails

Extends ​

Constructors ​

Constructor ​
ts
new QueryOutputValidationError(queryName, issues): QueryOutputValidationError;

Defined in: packages/worker/src/errors.ts:184

Parameters ​
ParameterType
queryNamestring
issuesreadonly Issue[]
Returns ​

QueryOutputValidationError

Overrides ​
ts
ValidationError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
category?readonly"BENIGN" | null-ValidationError.categorynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:113
cause?readonlyError-ValidationError.causenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:72
details?readonlyunknown[] | null-ValidationError.detailsnode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:111
failure?publicIFailureThe original failure that constructed this error. Only present if this error was generated from an external operation.ValidationError.failurenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:78
issuesreadonlyreadonly Issue[]-ValidationError.issuespackages/worker/src/errors.ts:38
messagepublicstring-ValidationError.messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstring-ValidationError.namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
nextRetryDelay?readonlyany-ValidationError.nextRetryDelaynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:112
nonRetryable?readonlyboolean | null-ValidationError.nonRetryablenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:110
queryNamereadonlystring--packages/worker/src/errors.ts:185
stack?publicstring-ValidationError.stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
type?readonlystring | null-ValidationError.typenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:109
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.ValidationError.stackTraceLimitnode_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:68

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType
targetObjectobject
constructorOpt?Function
Returns ​

void

Inherited from ​

ValidationError.captureStackTrace

create() ​
ts
static create(options): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:130

Create a new ApplicationFailure.

By default, will be retryable (unless its type is included in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterType
optionsApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.create

fromError() ​
ts
static fromError(error, overrides?): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:124

Create a new ApplicationFailure from an Error object.

First calls ensureApplicationFailure | `ensureApplicationFailure(error)` and then overrides any fields provided in overrides.

Parameters ​
ParameterType
errorunknown
overrides?ApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.fromError

nonRetryable() ​
ts
static nonRetryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:150

Get a new ApplicationFailure with the nonRetryable flag set to true.

When thrown from an Activity or Workflow, the Activity or Workflow will not be retried (even if type is not listed in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.nonRetryable

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType
errError
stackTracesCallSite[]
Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

ValidationError.prepareStackTrace

retryable() ​
ts
static retryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:139

Get a new ApplicationFailure with the nonRetryable flag set to false. Note that this error will still not be retried if its type is included in RetryPolicy.nonRetryableErrorTypes.

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type (used by RetryPolicy.nonRetryableErrorTypes)
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.retryable


SignalInputValidationError ​

Defined in: packages/worker/src/errors.ts:149

Error thrown when signal input validation fails

Extends ​

Constructors ​

Constructor ​
ts
new SignalInputValidationError(signalName, issues): SignalInputValidationError;

Defined in: packages/worker/src/errors.ts:150

Parameters ​
ParameterType
signalNamestring
issuesreadonly Issue[]
Returns ​

SignalInputValidationError

Overrides ​
ts
ValidationError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
category?readonly"BENIGN" | null-ValidationError.categorynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:113
cause?readonlyError-ValidationError.causenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:72
details?readonlyunknown[] | null-ValidationError.detailsnode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:111
failure?publicIFailureThe original failure that constructed this error. Only present if this error was generated from an external operation.ValidationError.failurenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:78
issuesreadonlyreadonly Issue[]-ValidationError.issuespackages/worker/src/errors.ts:38
messagepublicstring-ValidationError.messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstring-ValidationError.namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
nextRetryDelay?readonlyany-ValidationError.nextRetryDelaynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:112
nonRetryable?readonlyboolean | null-ValidationError.nonRetryablenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:110
signalNamereadonlystring--packages/worker/src/errors.ts:151
stack?publicstring-ValidationError.stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
type?readonlystring | null-ValidationError.typenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:109
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.ValidationError.stackTraceLimitnode_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:68

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType
targetObjectobject
constructorOpt?Function
Returns ​

void

Inherited from ​

ValidationError.captureStackTrace

create() ​
ts
static create(options): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:130

Create a new ApplicationFailure.

By default, will be retryable (unless its type is included in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterType
optionsApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.create

fromError() ​
ts
static fromError(error, overrides?): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:124

Create a new ApplicationFailure from an Error object.

First calls ensureApplicationFailure | `ensureApplicationFailure(error)` and then overrides any fields provided in overrides.

Parameters ​
ParameterType
errorunknown
overrides?ApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.fromError

nonRetryable() ​
ts
static nonRetryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:150

Get a new ApplicationFailure with the nonRetryable flag set to true.

When thrown from an Activity or Workflow, the Activity or Workflow will not be retried (even if type is not listed in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.nonRetryable

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType
errError
stackTracesCallSite[]
Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

ValidationError.prepareStackTrace

retryable() ​
ts
static retryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:139

Get a new ApplicationFailure with the nonRetryable flag set to false. Note that this error will still not be retried if its type is included in RetryPolicy.nonRetryableErrorTypes.

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type (used by RetryPolicy.nonRetryableErrorTypes)
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.retryable


UpdateInputValidationError ​

Defined in: packages/worker/src/errors.ts:200

Error thrown when update input validation fails

Extends ​

Constructors ​

Constructor ​
ts
new UpdateInputValidationError(updateName, issues): UpdateInputValidationError;

Defined in: packages/worker/src/errors.ts:201

Parameters ​
ParameterType
updateNamestring
issuesreadonly Issue[]
Returns ​

UpdateInputValidationError

Overrides ​
ts
ValidationError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
category?readonly"BENIGN" | null-ValidationError.categorynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:113
cause?readonlyError-ValidationError.causenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:72
details?readonlyunknown[] | null-ValidationError.detailsnode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:111
failure?publicIFailureThe original failure that constructed this error. Only present if this error was generated from an external operation.ValidationError.failurenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:78
issuesreadonlyreadonly Issue[]-ValidationError.issuespackages/worker/src/errors.ts:38
messagepublicstring-ValidationError.messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstring-ValidationError.namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
nextRetryDelay?readonlyany-ValidationError.nextRetryDelaynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:112
nonRetryable?readonlyboolean | null-ValidationError.nonRetryablenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:110
stack?publicstring-ValidationError.stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
type?readonlystring | null-ValidationError.typenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:109
updateNamereadonlystring--packages/worker/src/errors.ts:202
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.ValidationError.stackTraceLimitnode_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:68

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType
targetObjectobject
constructorOpt?Function
Returns ​

void

Inherited from ​

ValidationError.captureStackTrace

create() ​
ts
static create(options): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:130

Create a new ApplicationFailure.

By default, will be retryable (unless its type is included in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterType
optionsApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.create

fromError() ​
ts
static fromError(error, overrides?): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:124

Create a new ApplicationFailure from an Error object.

First calls ensureApplicationFailure | `ensureApplicationFailure(error)` and then overrides any fields provided in overrides.

Parameters ​
ParameterType
errorunknown
overrides?ApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.fromError

nonRetryable() ​
ts
static nonRetryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:150

Get a new ApplicationFailure with the nonRetryable flag set to true.

When thrown from an Activity or Workflow, the Activity or Workflow will not be retried (even if type is not listed in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.nonRetryable

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType
errError
stackTracesCallSite[]
Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

ValidationError.prepareStackTrace

retryable() ​
ts
static retryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:139

Get a new ApplicationFailure with the nonRetryable flag set to false. Note that this error will still not be retried if its type is included in RetryPolicy.nonRetryableErrorTypes.

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type (used by RetryPolicy.nonRetryableErrorTypes)
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.retryable


UpdateOutputValidationError ​

Defined in: packages/worker/src/errors.ts:217

Error thrown when update output validation fails

Extends ​

Constructors ​

Constructor ​
ts
new UpdateOutputValidationError(updateName, issues): UpdateOutputValidationError;

Defined in: packages/worker/src/errors.ts:218

Parameters ​
ParameterType
updateNamestring
issuesreadonly Issue[]
Returns ​

UpdateOutputValidationError

Overrides ​
ts
ValidationError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
category?readonly"BENIGN" | null-ValidationError.categorynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:113
cause?readonlyError-ValidationError.causenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:72
details?readonlyunknown[] | null-ValidationError.detailsnode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:111
failure?publicIFailureThe original failure that constructed this error. Only present if this error was generated from an external operation.ValidationError.failurenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:78
issuesreadonlyreadonly Issue[]-ValidationError.issuespackages/worker/src/errors.ts:38
messagepublicstring-ValidationError.messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstring-ValidationError.namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
nextRetryDelay?readonlyany-ValidationError.nextRetryDelaynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:112
nonRetryable?readonlyboolean | null-ValidationError.nonRetryablenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:110
stack?publicstring-ValidationError.stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
type?readonlystring | null-ValidationError.typenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:109
updateNamereadonlystring--packages/worker/src/errors.ts:219
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.ValidationError.stackTraceLimitnode_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:68

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType
targetObjectobject
constructorOpt?Function
Returns ​

void

Inherited from ​

ValidationError.captureStackTrace

create() ​
ts
static create(options): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:130

Create a new ApplicationFailure.

By default, will be retryable (unless its type is included in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterType
optionsApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.create

fromError() ​
ts
static fromError(error, overrides?): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:124

Create a new ApplicationFailure from an Error object.

First calls ensureApplicationFailure | `ensureApplicationFailure(error)` and then overrides any fields provided in overrides.

Parameters ​
ParameterType
errorunknown
overrides?ApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.fromError

nonRetryable() ​
ts
static nonRetryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:150

Get a new ApplicationFailure with the nonRetryable flag set to true.

When thrown from an Activity or Workflow, the Activity or Workflow will not be retried (even if type is not listed in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.nonRetryable

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType
errError
stackTracesCallSite[]
Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

ValidationError.prepareStackTrace

retryable() ​
ts
static retryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:139

Get a new ApplicationFailure with the nonRetryable flag set to false. Note that this error will still not be retried if its type is included in RetryPolicy.nonRetryableErrorTypes.

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type (used by RetryPolicy.nonRetryableErrorTypes)
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.retryable


WorkflowCancelledError ​

Defined in: packages/worker/src/errors.ts:377

Error surfaced in the Err(...) branch of an AsyncResult when a typed cancellation scope is cancelled via Temporal's cancellation propagation. Returned by both context.cancellableScope (when the workflow or an ancestor scope cancels) and context.nonCancellableScope (when cancellation is raised from inside the scope). Distinct from arbitrary thrown errors so call sites can branch on cancellation explicitly.

Non-cancellation errors thrown inside a scope are unmodeled failures: they surface on the scope's defect channel (re-thrown at the edge / inspectable via result.isDefect() and result.cause), not as a typed Err(...).

Extends ​

  • TaggedErrorInstance<"@temporal-contract/WorkflowCancelledError", { cause?: unknown; }>

Constructors ​

Constructor ​
ts
new WorkflowCancelledError(cause?): WorkflowCancelledError;

Defined in: packages/worker/src/errors.ts:383

Parameters ​
ParameterType
cause?unknown
Returns ​

WorkflowCancelledError

Overrides ​
ts
TaggedError(
  "@temporal-contract/WorkflowCancelledError",
  { name: "WorkflowCancelledError" },
)<{
  cause?: unknown;
}>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/WorkflowCancelledError"TaggedError( "@temporal-contract/WorkflowCancelledError", { name: "WorkflowCancelledError" }, )._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicunknownActivityDefinitionNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTaggedError( "@temporal-contract/WorkflowCancelledError", { name: "WorkflowCancelledError" }, ).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError( "@temporal-contract/WorkflowCancelledError", { name: "WorkflowCancelledError" }, ).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError( "@temporal-contract/WorkflowCancelledError", { name: "WorkflowCancelledError" }, ).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

WorkflowInputValidationError ​

Defined in: packages/worker/src/errors.ts:115

Error thrown when workflow input validation fails

Extends ​

Constructors ​

Constructor ​
ts
new WorkflowInputValidationError(workflowName, issues): WorkflowInputValidationError;

Defined in: packages/worker/src/errors.ts:116

Parameters ​
ParameterType
workflowNamestring
issuesreadonly Issue[]
Returns ​

WorkflowInputValidationError

Overrides ​
ts
ValidationError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
category?readonly"BENIGN" | null-ValidationError.categorynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:113
cause?readonlyError-ValidationError.causenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:72
details?readonlyunknown[] | null-ValidationError.detailsnode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:111
failure?publicIFailureThe original failure that constructed this error. Only present if this error was generated from an external operation.ValidationError.failurenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:78
issuesreadonlyreadonly Issue[]-ValidationError.issuespackages/worker/src/errors.ts:38
messagepublicstring-ValidationError.messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstring-ValidationError.namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
nextRetryDelay?readonlyany-ValidationError.nextRetryDelaynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:112
nonRetryable?readonlyboolean | null-ValidationError.nonRetryablenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:110
stack?publicstring-ValidationError.stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
type?readonlystring | null-ValidationError.typenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:109
workflowNamereadonlystring--packages/worker/src/errors.ts:117
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.ValidationError.stackTraceLimitnode_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:68

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType
targetObjectobject
constructorOpt?Function
Returns ​

void

Inherited from ​

ValidationError.captureStackTrace

create() ​
ts
static create(options): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:130

Create a new ApplicationFailure.

By default, will be retryable (unless its type is included in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterType
optionsApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.create

fromError() ​
ts
static fromError(error, overrides?): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:124

Create a new ApplicationFailure from an Error object.

First calls ensureApplicationFailure | `ensureApplicationFailure(error)` and then overrides any fields provided in overrides.

Parameters ​
ParameterType
errorunknown
overrides?ApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.fromError

nonRetryable() ​
ts
static nonRetryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:150

Get a new ApplicationFailure with the nonRetryable flag set to true.

When thrown from an Activity or Workflow, the Activity or Workflow will not be retried (even if type is not listed in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.nonRetryable

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType
errError
stackTracesCallSite[]
Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

ValidationError.prepareStackTrace

retryable() ​
ts
static retryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:139

Get a new ApplicationFailure with the nonRetryable flag set to false. Note that this error will still not be retried if its type is included in RetryPolicy.nonRetryableErrorTypes.

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type (used by RetryPolicy.nonRetryableErrorTypes)
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.retryable


WorkflowOutputValidationError ​

Defined in: packages/worker/src/errors.ts:132

Error thrown when workflow output validation fails

Extends ​

Constructors ​

Constructor ​
ts
new WorkflowOutputValidationError(workflowName, issues): WorkflowOutputValidationError;

Defined in: packages/worker/src/errors.ts:133

Parameters ​
ParameterType
workflowNamestring
issuesreadonly Issue[]
Returns ​

WorkflowOutputValidationError

Overrides ​
ts
ValidationError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
category?readonly"BENIGN" | null-ValidationError.categorynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:113
cause?readonlyError-ValidationError.causenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:72
details?readonlyunknown[] | null-ValidationError.detailsnode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:111
failure?publicIFailureThe original failure that constructed this error. Only present if this error was generated from an external operation.ValidationError.failurenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:78
issuesreadonlyreadonly Issue[]-ValidationError.issuespackages/worker/src/errors.ts:38
messagepublicstring-ValidationError.messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstring-ValidationError.namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
nextRetryDelay?readonlyany-ValidationError.nextRetryDelaynode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:112
nonRetryable?readonlyboolean | null-ValidationError.nonRetryablenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:110
stack?publicstring-ValidationError.stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
type?readonlystring | null-ValidationError.typenode_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:109
workflowNamereadonlystring--packages/worker/src/errors.ts:134
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.ValidationError.stackTraceLimitnode_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:68

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType
targetObjectobject
constructorOpt?Function
Returns ​

void

Inherited from ​

ValidationError.captureStackTrace

create() ​
ts
static create(options): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:130

Create a new ApplicationFailure.

By default, will be retryable (unless its type is included in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterType
optionsApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.create

fromError() ​
ts
static fromError(error, overrides?): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:124

Create a new ApplicationFailure from an Error object.

First calls ensureApplicationFailure | `ensureApplicationFailure(error)` and then overrides any fields provided in overrides.

Parameters ​
ParameterType
errorunknown
overrides?ApplicationFailureOptions
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.fromError

nonRetryable() ​
ts
static nonRetryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:150

Get a new ApplicationFailure with the nonRetryable flag set to true.

When thrown from an Activity or Workflow, the Activity or Workflow will not be retried (even if type is not listed in RetryPolicy.nonRetryableErrorTypes).

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.nonRetryable

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType
errError
stackTracesCallSite[]
Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

ValidationError.prepareStackTrace

retryable() ​
ts
static retryable(
   message?, 
   type?, ...
   details): ApplicationFailure;

Defined in: node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporalio/common/lib/failure.d.ts:139

Get a new ApplicationFailure with the nonRetryable flag set to false. Note that this error will still not be retried if its type is included in RetryPolicy.nonRetryableErrorTypes.

Parameters ​
ParameterTypeDescription
message?string | nullOptional error message
type?string | nullOptional error type (used by RetryPolicy.nonRetryableErrorTypes)
...details?unknown[]Optional details about the failure. Serialized by the Worker's PayloadConverter.
Returns ​

ApplicationFailure

Inherited from ​

ValidationError.retryable

Type Aliases ​

ContractErrorUnion ​

ts
type ContractErrorUnion<TErrors> = { [K in keyof TErrors & string]: ContractError<K, InferErrorData<TErrors[K]>> }[keyof TErrors & string];

Defined in: packages/contract/dist/errors.d.mts:74

Consumer-side union of ContractError instances for a declared errors map — data is typed with each schema's output (post-transform) shape. This is the union surfaced on the error channel of workflow-side activity calls and client-side workflow results.

Type Parameters ​

Type Parameter
TErrors extends Record<string, ErrorDefinition>

Functions ​

declareWorkflow() ​

ts
function declareWorkflow<TContract, TWorkflowName>(__namedParameters): (...args) => Promise<WorkerInferOutput<TContract["workflows"][TWorkflowName]>>;

Defined in: packages/worker/src/workflow.ts:176

Create a typed workflow implementation with automatic validation

This wraps a workflow implementation with:

  • Input/output validation
  • Typed workflow context with activities
  • Workflow info access

Workflows must be defined in separate files and imported by the Temporal Worker via workflowsPath.

Type Parameters ​

Type Parameter
TContract extends ContractDefinition
TWorkflowName extends string

Parameters ​

ParameterType
__namedParametersDeclareWorkflowOptions<TContract, TWorkflowName>

Returns ​

(...args) => Promise<WorkerInferOutput<TContract["workflows"][TWorkflowName]>>

Example ​

ts
// workflows/processOrder.ts
import { declareWorkflow } from '@temporal-contract/worker/workflow';
import myContract from '../contract.js';

export const processOrder = declareWorkflow({
  workflowName: 'processOrder',
  contract: myContract,
  activityOptions: {
    startToCloseTimeout: '1 minute',
  },
  // Optional: override `activityOptions` for specific activities. Each
  // entry shallow-merges over the workflow default — the override wins on
  // every property it specifies, including the whole `retry` block. The
  // override is Temporal's full `ActivityOptions`, so `taskQueue` works too,
  // letting you route individual activities to a dedicated worker pool.
  activityOptionsByName: {
    chargePayment: {
      startToCloseTimeout: '5 minutes',
      retry: { maximumAttempts: 5 },
    },
    // Route this activity to a dedicated, concurrency-capped queue.
    scoreRisk: { taskQueue: 'ml-inference' },
  },
  implementation: async (context, args) => {
    // context.activities: typed activities (workflow + global)
    // context.info: WorkflowInfo

    const inventory = await context.activities.validateInventory({
      orderId: args.orderId,
    });

    if (!inventory.available) {
      return { orderId: args.orderId, status: 'out_of_stock' };
    }

    const payment = await context.activities.chargePayment({
      customerId: args.customerId,
      amount: 100,
    });

    return {
      orderId: args.orderId,
      status: payment.success ? 'success' : 'failed',
      transactionId: payment.transactionId,
    };
  },
});

Then in your worker setup:

ts
// worker.ts
import { createWorker, workflowsPathFromURL } from '@temporal-contract/worker/worker';
import { activities } from './activities.js';
import myContract from './contract.js';

const worker = await createWorker({
  contract: myContract,
  connection,
  workflowsPath: workflowsPathFromURL(import.meta.url, './workflows.js'),
  activities,
}).getOrThrow();

References ​

ActivityInputValidationError ​

Re-exports ActivityInputValidationError


ActivityOutputValidationError ​

Re-exports ActivityOutputValidationError


AnyContractError ​

Re-exports AnyContractError


ContractError ​

Re-exports ContractError


ContractErrorConstructors ​

Re-exports ContractErrorConstructors


ContractErrorDataValidationError ​

Re-exports ContractErrorDataValidationError


ContractErrorOptions ​

Re-exports ContractErrorOptions


ValidationError ​

Re-exports ValidationError

Released under the MIT License.