# bunqueue v2.8.13

Fixes 3 bugs. moveToFailed() sends the stack.

Canonical: https://bunqueue.dev/blog/bunqueue-v2-8-13/

---

<!-- Generated from changelog.md by docs/scripts/generate-release-posts.ts. Edit the changelog and regenerate. -->

Fixes 3 bugs. moveToFailed() sends the stack.

![](https://github.com/egeominotti.png?size=64) [egeominotti](https://github.com/egeominotti)

#### To install bunqueue v2.8.13

```bash title="bun"
bun add bunqueue@2.8.13
```

```bash title="npm"
npm install bunqueue@2.8.13
```

#### To upgrade bunqueue

```bash
bun add bunqueue@latest
```

## Bugfixes

The 2.8.11 fix wired the failure stack through the **natural-throw** path only: a
processor that `throw`s gets its stack sent on `FAIL` (persisted server-side) and set
on the local `failed` event's `job.stacktrace`. A processor that catches the error and
reports it explicitly with `await job.moveToFailed(err)` went through a different code
path that never touched the stack, so, as @arthurvanl's repro showed, `job.stacktrace`
was `null` on the `failed` event and `queue.getJob(id).stacktrace` stayed `null`, while
an equivalent natural throw populated both.

- **`moveToFailed()` sends the stack.** The explicit handler now computes the stack
  lines and includes them on `FAIL` (`stack`, TCP) / `manager.fail(..., wireStack)`
  (embedded), so the server persists them exactly like the throw path, visible via
  `getJob()` and in DLQ entries.
- **Local `failed` event populated.** The manual-move handler now sets
  `job.stacktrace` (capped at `job.stackTraceLimit`) on the emitted job, matching the
  natural-throw behavior.
- The stack-splitting logic is now a single shared `computeStackLines()` helper used by
  both paths, so they can't drift apart again.

Reproduced in both modes with `test/repro-issue74-movetofailed-stacktrace.test.ts`
(local event + server-side `getJob()` persistence, embedded and TCP).

## Thanks to 1 contributor!

- [@egeominotti](https://github.com/egeominotti)

---

[← bunqueue v2.8.12](https://bunqueue.dev/blog/bunqueue-v2-8-12/) · [Release on GitHub](https://github.com/egeominotti/bunqueue/releases/tag/v2.8.13) · [Commits since v2.8.12](https://github.com/egeominotti/bunqueue/compare/v2.8.12...v2.8.13) · [Full changelog](https://bunqueue.dev/changelog/) · [All posts](https://bunqueue.dev/blog/)
