Skip to content

[plugin-import-export] CSV download drops array items beyond the columns of the first batch #19140

Open

Description

@tiendungnguyen24

Describe the Bug

In a streamed CSV download, the columns are fixed after the first batch. A document in a later batch with a longer array than every document in the first batch loses its extra array items. There is no error and no log.

Example: 100 posts with 1 item each, then a post with 3 items in the second batch (default batchSize 100). The header has only items_0_*, so items 2 and 3 of that post are not in the CSV. The JSON download of the same query has all 3 items.

Link to the code that reproduces this issue

https://github.com/tiendungnguyen24/payload-import-export-csv-repro

Reproduction Steps

  1. Clone the repository, pnpm install, cp .env.example .env.
  2. pnpm payload run src/seed.ts (100 posts with 1 item, then post 101 with 3 items).
  3. pnpm dev.
  4. ./repro.sh (CSV download sorted by createdAt, so post 101 is in batch 2).
  5. The header is id,title,items_0_label,items_0_id,... and the row of post 101 has only item a.

Which area(s) are affected?

plugin: import-export

Environment Info

payload: 3.92.1
@payloadcms/plugin-import-export: 3.92.1
@payloadcms/db-sqlite: 3.92.1
next: 16.3.3
Node: 26.5.1
pnpm: 11.23.0
OS: macOS (darwin arm64)

Activity

  1. cestercian commented on Oct 28, 2026

    @cestercian

    hey, I'd like to take this one, have a fix in progress so the CSV columns cover later batches too.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions