Repository navigation
fix(cohorts): accept BOM-prefixed CSV when building a static cohort - #82082
Merged
trunk-io[bot] merged 4 commits intoAug 25, 2026
Merged
trunk-io[bot] merged 4 commits into
trunk-io[bot] merged 4 commits into
Conversation
Files saved by Excel or Google Sheets prefix the first header with a byte order mark, so `person_id` did not match the supported ID headers and the upload failed with a self-contradictory error that listed the very columns it rejected. Decode uploads with utf-8-sig and strip the byte order mark in the shared header normalization, so the person_id, distinct_id, and email checks agree. Quote the echoed column names in the missing-header message so an invisible character reads as a file problem, not a contradiction. Generated-By: PostHog Desktop Task-Id: da273aaa-f95e-4768-aa0a-f3a70c917714
|
😎 Merged successfully - details. |
Contributor
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the |
patricio-posthog
self-requested a review
August 24, 2026 18:48
patricio-posthog
marked this pull request as ready for review
August 24, 2026 19:18
Contributor
🤖 CI report
|
Generated-By: PostHog Desktop Task-Id: d226f8d2-c9c7-454b-848e-88abdd2dff40
…-prefixed-csv-58af1b
patricio-posthog
approved these changes
Aug 25, 2026
…-prefixed-csv-58af1b
trunk-io
Bot
deleted the
posthog-self-driving/fixcohorts-accept-bom-prefixed-csv-58af1b
branch
August 25, 2026 13:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
person_id. The upload decoded with plainutf-8and normalized headers with only.strip(), which does not remove, so the match failed. The byte order mark renders as nothing, so both the file and the error look correct.person_idheader fell through to the backwards-compatible path and imported the header text itself as one junk cohort member.Refs #42539
Changes
utf-8-sig, which strips the leading byte order mark._normalize_headerthat also removes, so_find_id_column,_is_person_id_header, and_is_email_headerall agree — a second layer that holds even if a mark appears mid-file.'name', 'age'), so an empty or invisible header reads as a file problem instead of a contradiction.Not in scope: the report also notes conflicting save toasts in
cohortEditLogic.ts. That is a separate, lower-severity UX issue in the frontend flow and does not cause the blocking error above, so it is left for a follow-up.How did you test this code?
person_idheader.person_idheader text is treated as a header, not imported as a member.Automatic notifications
Docs update
None.
🤖 Agent context
Autonomy: Fully autonomous
utf-8-sigat decode plus BOM stripping in header normalization — rather than only one, so the single-column path and any mid-file mark are also covered. The message change avoids echoing an invisible character back as a contradiction.example.comaddresses; nothing from the source report is committed.Created with PostHog Desktop from this inbox report.