> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# context.cancel

All of the methods covered so far are used to define workflow steps.

`context.cancel` is different — it allows you to **explicitly cancel the current workflow run**.

```ts theme={"system"}
export const { POST } = serve<{ topic: string }>(async (context) => {
  const payload = context.requestPayload

  const result = await context.run("check if canceled", () => { ... });

  if (result.cancel) {
    await context.cancel() // cancel the workflow run
  }
})
```

When a workflow run is canceled:

* It is labeled as **canceled** (not failed).
* The configured `failureFunction` **is not triggered**.
* No entries are sent to the **dead-letter queue (DLQ)**.
