docs/solutions/logic-errors/2026-03-23-csv-header-mode-validity-check-must-handle-object-rows.md
CsvPlugin is supposed to deserialize plain CSV into a Slate table.
Valid input like name,age\nAda,36 returned undefined on the default path because Papa Parse was configured with header: true, but the validity check still treated the parsed rows like arrays.
deserializeCsv used one validation shape for both parse modes:
data.length < 2 || data[0].length < 2 || data[1].length < 2
That only makes sense for array rows. In header mode, Papa returns objects plus meta.fields, so:
data.length counts only data rows, not the header rowdata[0].length is undefinedSo valid header-based CSV was rejected before the AST builder ever ran.
Split validation by parse shape:
meta.fields for column count and requires at least one data rowThat makes the default plugin path valid again without weakening the malformed-CSV guardrails.
These checks passed:
bun test packages/csv/src
pnpm test:slowest -- --top 20 packages/csv/src
pnpm turbo build --filter=./packages/csv
pnpm turbo typecheck --filter=./packages/csv
When a parser supports both header mode and array mode, test both. They are not the same data shape, and pretending otherwise is how you ship a broken default.