UNPKG

workflow

Version:

Workflow SDK - Build durable, resilient, and observable workflows

57 lines (43 loc) • 2.06 kB
--- title: WorkflowNotRegisteredError description: Thrown when a workflow function is not registered in the current deployment. type: reference summary: Catch WorkflowNotRegisteredError when a workflow function cannot be found during execution. related: - /docs/errors/workflow-not-registered - /docs/api-reference/workflow-errors/step-not-registered-error --- `WorkflowNotRegisteredError` is thrown when the runtime tries to execute a workflow function that is not registered in the current deployment. This is an infrastructure error, not a user code error. It typically means a run was started against a deployment that does not have this workflow (e.g., the workflow was renamed or moved), or there was a build/bundling issue. When this error occurs, the run fails with a `RUNTIME_ERROR` error code. ```typescript lineNumbers import { WorkflowNotRegisteredError } from "workflow/errors" declare const error: unknown; // @setup if (WorkflowNotRegisteredError.is(error)) { // [!code highlight] console.error("Workflow not registered:", error.workflowName); } ``` ## API signature ### Properties <TSDoc definition={` interface WorkflowNotRegisteredError { /** The name of the workflow function that was not found. */ workflowName: string; /** The error message. */ message: string; } export default WorkflowNotRegisteredError;`} /> ### Static methods #### `WorkflowNotRegisteredError.is(value)` Type-safe check for `WorkflowNotRegisteredError` instances. Preferred over `instanceof` because it works across module boundaries and virtual machine contexts. <Callout> The `.is()` method works in server-side Node.js code (API routes, middleware). When checking the error from `run.returnValue`, use `WorkflowRunFailedError.is()` and inspect `error.cause`: the underlying error is deserialized from the event log. </Callout> ```typescript import { WorkflowNotRegisteredError } from "workflow/errors" declare const error: unknown; // @setup if (WorkflowNotRegisteredError.is(error)) { // error is typed as WorkflowNotRegisteredError } ```