HookConflictError

Thrown when creating a hook with a token that is already in use by another workflow run.

HookConflictError is thrown when creating a hook with a token that is already in use by another active workflow run. Hook tokens must be unique across all running workflows — see the hook-conflict error guide for resolution strategies.

import { HookConflictError } from "workflow/errors"
declare function startApprovalWorkflow(token: string): Promise<void>; // @setup
declare const token: string; // @setup

try {
  await startApprovalWorkflow(token);
} catch (error) {
  if (HookConflictError.is(error)) {
    console.error(
      `Token "${error.token}" already in use by run ${error.conflictingRunId}`
    );
  }
}

API Signature

Properties

NameTypeDescription
tokenstringThe hook token that conflicted.
conflictingRunIdstringThe run ID of the workflow currently holding the token, when known.
messagestringThe error message.

Static Methods

HookConflictError.is(value)

Type-safe check for HookConflictError instances. Preferred over instanceof because it works across module boundaries and VM contexts.

import { HookConflictError } from "workflow/errors"
declare const error: unknown; // @setup

if (HookConflictError.is(error)) {
  // error is typed as HookConflictError
}