Repository navigation
fix: klaviyo upload partial failures - #7107
Conversation
🔒 Scanned for secrets using gitleaks 8.29.1
fc16e3c to
e596615
Compare
🔒 Scanned for secrets using gitleaks 8.29.1
|
In res.abortReason = fmt.Sprintf("profile rejected by Klaviyo's synchronous validation: %s", reason)So when a chunk has more than one invalid profile, only the last rejected profile's reason survives into Not a regression (the single-reason field predates this PR), but worth considering aggregating the reasons — e.g. joining |
|
This looks like a limitation of the framework. Since we return multiple |
|
At the marshal site: importParameters, err := jsonrs.Marshal(common.ImportParameters{
ImportId: strings.Join(importIds, IMPORT_ID_SEPARATOR),
ImportCount: len(successJobs),
})
...
successJobs, _ = lo.Difference(importingJobIDs, append(failedJobs, abortedJobs...))
Pre-existing (not introduced by this PR), but the fix is a one-liner — move the successJobs, _ = lo.Difference(importingJobIDs, append(failedJobs, abortedJobs...))
importParameters, err := jsonrs.Marshal(common.ImportParameters{
ImportId: strings.Join(importIds, IMPORT_ID_SEPARATOR),
ImportCount: len(successJobs),
}) |
Seems like an existing bug, let me fix it. Fixed existing test as well. |
🔒 Scanned for secrets using gitleaks 8.29.1
🤖 I have created a release *beep* *boop* --- ## [1.77.4](v1.77.3...v1.77.4) (2026-06-22) ### Bug Fixes * klaviyo upload partial failures ([#7107](#7107)) ([621a070](621a070)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
# Description Syncing patch release v1.77.4 to main branch **↓↓ Please review and edit commit overrides before merging ↓↓** BEGIN_COMMIT_OVERRIDE fix: klaviyo upload partial failures (#7107) END_COMMIT_OVERRIDE --------- Co-authored-by: Aris Tzoumas <[email protected]> Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com> Co-authored-by: shekhar-rudder <[email protected]> Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]> Co-authored-by: Sudip Paul <[email protected]> Co-authored-by: Akash Chetty <[email protected]> Co-authored-by: Akash Chetty <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [1.78.0-rc.1](v1.77.0...v1.78.0-rc.1) (2026-06-22) ### Features * add and register bq stream v2 async destination manager ([#7057](#7057)) ([787b7ac](787b7ac)) * add BQSTREAM_V2 destination type and bqstreamv2 building blocks ([#7056](#7056)) ([02e84e5](02e84e5)) * **batchrouter:** raise getImportingJobs max iterations and remove payload size limit ([#7076](#7076)) ([15707f6](15707f6)) * **gateway:** throttling support for internal batch endpoint ([#7055](#7055)) ([6b6ba65](6b6ba65)) * **jobsdb:** introduce compaction min ds age ([#7077](#7077)) ([4d6d97a](4d6d97a)) * **processor:** new intermediate jobsdb ([#7048](#7048)) ([dfef1f1](dfef1f1)) ### Bug Fixes * abort non-retryable Klaviyo upload errors instead of retrying ([#7085](#7085)) ([4c3e4f1](4c3e4f1)) * **batchrouter:** correlate poll results by externalId instead of whole-row hash ([09326d2](09326d2)) * **batchrouter:** report real status code and sample event for drained jobs ([#7104](#7104)) ([d3fab82](d3fab82)) * internal endpoints enabled in open source version of rudder-server ([#7075](#7075)) ([dc071cd](dc071cd)) * **jobsdb:** get jobs lateral join against the v_last view ([#7105](#7105)) ([853d14c](853d14c)) * klaviyo upload partial failures ([#7107](#7107)) ([37e79e9](37e79e9)) * **router:** shared barrier causing illegal job sequence errors ([#7101](#7101)) ([b5435ba](b5435ba)) ### Miscellaneous * add BQSTREAM_V2 integration tests ([#7058](#7058)) ([478e217](478e217)) * add rudderai announcement ([#7046](#7046)) ([ff02fe8](ff02fe8)) * bump codecov-action to 7.0.0 ([#7070](#7070)) ([31f0623](31f0623)) * cleanup embedded warehouse transformations ([#7072](#7072)) ([31f0623](31f0623)) * **deps:** bump actions/checkout from 6.0.2 to 6.0.3 ([#7084](#7084)) ([745d5ab](745d5ab)) * **deps:** bump aws-actions/configure-aws-credentials from 6.1.2 to 6.2.0 ([#7081](#7081)) ([19251cd](19251cd)) * **jobsdb:** refactoring and cleanup ([#7043](#7043)) ([2e4ea92](2e4ea92)) * remove legacy warehouse endpoints ([#7090](#7090)) ([6f85153](6f85153)) * rename bqstream all events ([#7088](#7088)) ([4d9ad19](4d9ad19)) * **router:** rename experimental buffer size calculator to dynamic ([#7103](#7103)) ([52896cd](52896cd)) * support using the full event schema key as pulsar ordering key ([#7086](#7086)) ([ff50611](ff50611)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [1.78.0](v1.77.0...v1.78.0) (2026-06-22) ### Features * add and register bq stream v2 async destination manager ([#7057](#7057)) ([787b7ac](787b7ac)) * add BQSTREAM_V2 destination type and bqstreamv2 building blocks ([#7056](#7056)) ([02e84e5](02e84e5)) * **batchrouter:** raise getImportingJobs max iterations and remove payload size limit ([#7076](#7076)) ([15707f6](15707f6)) * **gateway:** throttling support for internal batch endpoint ([#7055](#7055)) ([6b6ba65](6b6ba65)) * **jobsdb:** introduce compaction min ds age ([#7077](#7077)) ([4d6d97a](4d6d97a)) * **processor:** new intermediate jobsdb ([#7048](#7048)) ([dfef1f1](dfef1f1)) ### Bug Fixes * abort non-retryable Klaviyo upload errors instead of retrying ([#7085](#7085)) ([4c3e4f1](4c3e4f1)) * **batchrouter:** correlate poll results by externalId instead of whole-row hash ([09326d2](09326d2)) * **batchrouter:** report real status code and sample event for drained jobs ([#7104](#7104)) ([d3fab82](d3fab82)) * internal endpoints enabled in open source version of rudder-server ([#7075](#7075)) ([dc071cd](dc071cd)) * **jobsdb:** get jobs lateral join against the v_last view ([#7105](#7105)) ([853d14c](853d14c)) * klaviyo upload partial failures ([#7107](#7107)) ([37e79e9](37e79e9)) * **router:** shared barrier causing illegal job sequence errors ([#7101](#7101)) ([b5435ba](b5435ba)) ### Miscellaneous * add BQSTREAM_V2 integration tests ([#7058](#7058)) ([478e217](478e217)) * add rudderai announcement ([#7046](#7046)) ([ff02fe8](ff02fe8)) * bump codecov-action to 7.0.0 ([#7070](#7070)) ([31f0623](31f0623)) * cleanup embedded warehouse transformations ([#7072](#7072)) ([31f0623](31f0623)) * **deps:** bump actions/checkout from 6.0.2 to 6.0.3 ([#7084](#7084)) ([745d5ab](745d5ab)) * **deps:** bump aws-actions/configure-aws-credentials from 6.1.2 to 6.2.0 ([#7081](#7081)) ([19251cd](19251cd)) * **jobsdb:** refactoring and cleanup ([#7043](#7043)) ([2e4ea92](2e4ea92)) * remove legacy warehouse endpoints ([#7090](#7090)) ([6f85153](6f85153)) * rename bqstream all events ([#7088](#7088)) ([4d9ad19](4d9ad19)) * **router:** rename experimental buffer size calculator to dynamic ([#7103](#7103)) ([52896cd](52896cd)) * support using the full event schema key as pulsar ordering key ([#7086](#7086)) ([ff50611](ff50611)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
🔒 Scanned for secrets using gitleaks 8.29.1
Description
Klaviyo's Bulk Profile Import API validates each request all-or-nothing: a single profile that fails synchronous validation (e.g. a malformed email) causes Klaviyo to reject the entire batch with HTTP 400, importing zero profiles. Today rudder-server mirrors that by aborting the whole chunk, so one bad record takes down every valid profile alongside it.
This PR adds strip-and-retry on failure. When Klaviyo returns a 400 whose error pointers identify specific profiles, we abort only those jobs and re-upload the chunk once with the remaining valid profiles, so the good records still get delivered.
Behavior
listId) → whole chunk aborted, unchanged.The retry path is bounded to a single extra attempt — there is no loop.
Implementation
uploadChunkorchestrates the try → strip → retry-once flow.tryUploadperforms one upload attempt and normalizes the status/error.strippableProfilesdecides whether a failure is a per-profile 400 we can safely retry.extractInvalidProfileIndicesparses the offending profile indices from Klaviyo's JSON pointers.recordErrorclassifies remaining jobs as aborted (4xx) vs failed (5xx/429).chunkUploadResult(added totypes.go) carries the per-chunk outcome.Linear Ticket
Security