Skip to content

fix(upload): publish stems sequentially after parent track - #14547

Merged
dylanjeffers merged 1 commit into
mainfrom
fix/stem-upload-race-condition
Aug 4, 2026
Merged

fix(upload): publish stems sequentially after parent track#14547
dylanjeffers merged 1 commit into
mainfrom
fix/stem-upload-race-condition

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

Problem

When uploading a contest track + stems simultaneously on audius.co, the UI gets permanently stuck on "Uploading Your Track" with red ⚠ error icons on every stem and the track itself — even though the upload succeeded (the contest page works after navigating away).

Reproducible on: Burko contest, Andrew Lux contest, Audius Summer Cypher Vol 2.

Root cause

In usePublishTracks.ts, publishParentTrack() and publishStems() were running concurrently via Promise.all:

// Before (race condition)
const [trackResult, stemsResults] = await Promise.all([
  publishParentTrack(),
  publishStems(context, { ..., parentTrackId: trackId })
])

publishStems received the trackId (generated by sdk.tracks.generateTrackId()) and passed it to each stem publish call — but because both ran in parallel, the stems were being published before the parent track was confirmed on-chain. Every publishStem API call failed as a result, dispatching ProgressStatus.ERROR for each stem row.

Fix

Await the parent track first, then publish stems:

// After (sequential, correct)
const trackResult = await publishParentTrack()
const stemsResults = await publishStems(context, { ..., parentTrackId: trackId })

This ensures the parent track is on-chain before any stem references it, eliminating the race condition.

When uploading a contest track + stems, publishParentTrack() and
publishStems() ran concurrently via Promise.all. This caused stems
to be published before the parent track was confirmed on-chain, so
every publishStem API call failed. The UI showed red ⚠ error icons
on all stem rows even though the upload actually succeeded.

Reproducible on: Burko contest, Andrew Lux contest, Audius Summer
Cypher Vol 2.

Fix: await publishParentTrack() first, then await publishStems().
This ensures the parent track is on-chain before any stem references
it, eliminating the race condition.
@changeset-bot

changeset-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: cb67462

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dylanjeffers
dylanjeffers merged commit 8fca756 into main Aug 4, 2026
17 checks passed
@dylanjeffers
dylanjeffers deleted the fix/stem-upload-race-condition branch August 4, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant