Skip to content

🐛 Duplicating a duplicated event returns 500 #1135

@ptaranat

Description

@ptaranat

Describe the bug
Duplicating an event that was itself created via the "Duplicate Event" feature returns a 500 error. Duplicating the original source event works fine, but duplicating the copy does not.

To Reproduce

  1. Go to the organizer dashboard
  2. Create an event with at least one product and a capacity assignment or check-in list
  3. Click "Duplicate Event" on the event -> duplication succeeds (Event B created)
  4. Click "Duplicate Event" on Event B -> 500 Internal Server Error

Expected behavior
Duplicating any event should succeed regardless of whether it was itself created via duplication.

Screenshots

Image

Logs
Endpoint: POST /events/{event_id}/duplicate

Request payload:

{
  "title": "Copy of Event B",
  "start_date": "2026-04-01T00:00:00.000Z",
  "duplicate_products": true,
  "duplicate_questions": true,
  "duplicate_settings": true,
  "duplicate_promo_codes": true,
  "duplicate_capacity_assignments": true,
  "duplicate_check_in_lists": true,
  "duplicate_event_cover_image": true,
  "duplicate_ticket_logo": true,
  "duplicate_webhooks": true,
  "duplicate_affiliates": true
}

Response: 500 Internal Server Error

{
  "message": "Server Error"
}

Based on source, the 500 is an Undefined array key error in DuplicateEventService.php. When cloning capacity assignments, check-in lists, per-product questions, and promo codes, the code accesses $oldProductToNewProductMap[$product->getId()] without verifying that the key exists:

  • cloneCapacityAssignments() — line 299
  • cloneCheckInLists() — line 315
  • clonePerProductQuestions() — line 235
  • clonePromoCodes() — line 276

The map is built from products iterated via $event->getProductCategories()->...->getProducts(), but capacity assignment and check-in list product relationships are loaded separately via their own Relationship(ProductDomainObject::class). If any of those referenced product IDs aren't present as keys in the map, the lookup fails.

Desktop:

  • OS: Windows 11 / WSL2
  • Browser: Chrome 134

Hi.Events Version and platform
Cloud hosted (app.hi.events)

Additional context
Workaround: duplicate from the original event, not from a copy. A fix could add an array_key_exists guard or use the null coalescing operator when accessing $oldProductToNewProductMap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions