Skip to content

500 error from duplicate ID in collection tree following reorder of entries #11209

Closed

Description

@wesort

Bug description

Reordering a new entry causes a duplicate ID in the collection tree.

Similar to #2662 (closed) and #9531 (open).

How to reproduce

NB: I'm struggling to recreate this in my dev env. The client has managed to cause the issue a couple of times but not entirely sure what is triggering it.

Steps:

  • Create a new entry in an orderable collection and publish it.
  • Reorder the entries and save.
  • Result: 500 error on front-end that doesn't use custom error template

Only certain users seem to cause this issue:

  • Their preferences & permissions are the same apart from collection listing columns being displayed
  • Users on Windows 11 using Chrome.
  • Workaround seems to be: refresh the collection listing (ie: cmd + r in the browser) after publishing the new entry but before reordering.

Logs

No response

Environment

Environment
Application Name: Red + White
Laravel Version: 11.34.1
PHP Version: 8.3.13
Composer Version: 2.8.3
Environment: production
Debug Mode: OFF
URL: redandwhite.co
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: CACHED
Events: CACHED
Routes: CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Statamic
Addons: 1
Sites: 1
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.40.0 PRO

Statamic Addons
jacksleight/statamic-bard-mutator: 3.0.3

Installation

Fresh statamic/statamic site via CLI

Additional details

Further context:

  • List of entries in the tree includes a duplicate ID at the end after using Reorder button in the CP.
  • Results in 500 error on the front-end (see below)
    • NB: APP_DEBUG=false so I presume the custom error template /resources/views/errors/500.blade.php should be presented instead?
  • Results in Server error in CP listing for that collection but no further info
  • The duplicate ID CP page doesn't appear. I presume as it's not a duplicate entry in the collection, but a duplicate entry in the tree.
  • The position of the newly created entry seems random. Sometimes it's at the top of the listing (desired) and sometimes at the bottom.

front-end error screenshot

Screenshot 2024-12-02 14 10 33

CP error screenshot

Screenshot 2024-12-02 14 09 17

Activity

  1. wesort commented on Dec 2, 2024

    @wesort
    SponsorContributorAuthor

    Update: I think this is due to the user's choice with the number of entries to include in the pagination in the CP. Users that cause the issue have this set to 50 (default) and there are more than 50 entries in the collection. Changing 100 fixes it.

    preferences:
      collections:
        projects:
          per_page: 100
    
    

    image

  2. JelleGroenendal commented on Apr 22, 2025

    @JelleGroenendal

    This happens when pagination is enabled on the sort page.
    It duplicates all entries on the active page in to to the trees yaml.

    When this happens you cant solve it other then removing the duplicates manually.

    It can be directed to this specific line:

    https://github.com/statamic/cms/blob/5.x/src/Structures/CollectionStructure.php#L72

    When this exception is removed the file gets fixed duplicates get removed and you don't get the broken list view.
    I'm not sure if this is the correct solution i don't know if there is a specific reasoning for this.

  3. JelleGroenendal commented on Apr 22, 2025

    @JelleGroenendal
  4. marcorieser commented on Jun 18, 2026

    @marcorieser
    Contributor

    Jup, this is still relevant

  5. aleskozina commented on Jul 2, 2026

    @aleskozina

    Been fighting this issue on and off this week with my client. And can confirm that the workaround works; set the "per page" to 100 (or probably just more than there are entries).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions