Skip to content

@temporal-contract/worker


@temporal-contract/worker / workflow

workflow

Classes

ChildWorkflowCancelledError

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

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; message: string; workflowName: string; }>

Constructors

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

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

Parameters
ParameterType
workflowNamestring
cause?unknown
Returns

ChildWorkflowCancelledError

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

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/ChildWorkflowCancelledError"TaggedError( "@temporal-contract/ChildWorkflowCancelledError", { name: "ChildWorkflowCancelledError" }, )._tagnode_modules/.pnpm/unthrown@0.2.0/node_modules/unthrown/dist/index.d.mts:638
cause?publicunknownActivityDefinitionNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringActivityInputValidationError.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:295

ChildWorkflowError

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

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; message: string; }>

Constructors

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

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

Parameters
ParameterType
messagestring
cause?unknown
Returns

ChildWorkflowError

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

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/ChildWorkflowError"TaggedError("@temporal-contract/ChildWorkflowError", { name: "ChildWorkflowError", })._tagnode_modules/.pnpm/unthrown@0.2.0/node_modules/unthrown/dist/index.d.mts:638
cause?publicunknownActivityDefinitionNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringActivityInputValidationError.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:238

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

Extends

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

Constructors

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

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

Parameters
ParameterTypeDefault value
workflowNamestringundefined
availableWorkflowsreadonly string[][]
Returns

ChildWorkflowNotFoundError

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

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/ChildWorkflowNotFoundError"TaggedError( "@temporal-contract/ChildWorkflowNotFoundError", { name: "ChildWorkflowNotFoundError" }, )._tagnode_modules/.pnpm/unthrown@0.2.0/node_modules/unthrown/dist/index.d.mts:638
availableWorkflowsreadonlyreadonly string[]TaggedError( "@temporal-contract/ChildWorkflowNotFoundError", { name: "ChildWorkflowNotFoundError" }, ).availableWorkflowspackages/worker/src/errors.ts:243
cause?publicunknownTaggedError( "@temporal-contract/ChildWorkflowNotFoundError", { name: "ChildWorkflowNotFoundError" }, ).causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringActivityInputValidationError.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:242

QueryInputValidationError

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

Error thrown when query input validation fails

Extends

Constructors

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

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

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:172
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:187

Error thrown when query output validation fails

Extends

Constructors

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

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

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:189
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:153

Error thrown when signal input validation fails

Extends

Constructors

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

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

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:155
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:204

Error thrown when update input validation fails

Extends

Constructors

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

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

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:206
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:221

Error thrown when update output validation fails

Extends

Constructors

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

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

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:223
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:316

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; message: string; }>

Constructors

Constructor
ts
new WorkflowCancelledError(cause?): WorkflowCancelledError;

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

Parameters
ParameterType
cause?unknown
Returns

WorkflowCancelledError

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

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/WorkflowCancelledError"TaggedError( "@temporal-contract/WorkflowCancelledError", { name: "WorkflowCancelledError" }, )._tagnode_modules/.pnpm/unthrown@0.2.0/node_modules/unthrown/dist/index.d.mts:638
cause?publicunknownActivityDefinitionNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringActivityInputValidationError.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:119

Error thrown when workflow input validation fails

Extends

Constructors

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

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

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:121
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:136

Error thrown when workflow output validation fails

Extends

Constructors

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

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

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:138
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

Functions

declareWorkflow()

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

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

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';

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 } from '@temporal-contract/worker/worker';
import { activities } from './activities';
import myContract from './contract';

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

References

ActivityInputValidationError

Re-exports ActivityInputValidationError


ActivityOutputValidationError

Re-exports ActivityOutputValidationError


ValidationError

Re-exports ValidationError

Released under the MIT License.