Skip to content

BeforeChange hook error does not bubble up when re-ordering items #16308

@AlexRoosWork

Description

@AlexRoosWork

Describe the Bug

When having a collection with orderable: true and hooks that may throw an APIError(), the error from the hook does not bubble up when re-ordering the items. Instead the generic error "Failed to reorder. This can happen if you reorder several rows too quickly. Please try again." is shown.

My guess is that the ordering action is trying to save the document with payload, this runs through the hooks and if a hook throws, then the ordering action fails. Instead of the error of the hook being shown there is a fallback error that is displayed.

I would love to have the APIError that is thrown in the hook to bubble up and be displayed instead.

Link to the code that reproduces this issue

https://github.com/AlexRoosWork/re-ordering-items

Reproduction Steps

Create at least two entries in the Sample Collection.
Caution, there is a hook that throws 50% of the time, so you may need to try several times.

Try to re-order the items in the list view until the hook throws.

Which area(s) are affected?

area: ui

Environment Info

Binaries:
  Node: 24.14.1
  npm: 11.11.0
  Yarn: N/A
  pnpm: 10.28.0
Relevant Packages:
  payload: 3.83.0
  next: 16.2.3
  @payloadcms/db-mongodb: 3.83.0
  @payloadcms/graphql: 3.83.0
  @payloadcms/next/utilities: 3.83.0
  @payloadcms/richtext-lexical: 3.83.0
  @payloadcms/translations: 3.83.0
  @payloadcms/ui/shared: 3.83.0
  react: 19.2.4
  react-dom: 19.2.4
Operating System:
  Platform: linux
  Arch: x64
  Version: #1-NixOS SMP PREEMPT_DYNAMIC Thu Apr  2 11:09:54 UTC 2026
  Available memory (MB): 64022
  Available CPU cores: 20

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: uiRelated to the admin panel.status: needs-triagePossible bug which hasn't been reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions