Skip to content

fix(worker): three production errors from transfers - #4

Merged
marctorrelles merged 3 commits into
mainfrom
fix/crashyard-errors
Nov 4, 2026
Merged

marctorrelles merged 3 commits into
mainfrom
fix/crashyard-errors

Conversation

@marctorrelles

Copy link
Copy Markdown
Owner

Fixes the three unresolved sideload errors in crashyard.

Playlists past 5,000 songs (`Maximum playlist size exceeded`, 18 events, two transfers failed)
YouTube caps a playlist at 5,000 songs. The next add was a plain error, so the job retried eight times and failed with `provider_error`. Now a playlist fills to the cap and continues in " (2)", "(3)" and so on, the Liked Songs mirror included; likes stay uncapped. Each track records the part it went into (`track.yt_pl`), so verify reads every part and the re-drive puts a missing song back into its own part. Running jobs get the column on load, backfilled from their single playlist. Each extra part costs 50 Data API units.

Read-back 404 `playlistNotFound` (2 events)
Reading a playlist a second after creating it, or its next page, can 404 until Google catches up. The job recovered on retry, but each hit was reported and counted towards the eight retries. It is now a throttle: back off and read again.

`UNIQUE constraint failed: item.id` (2 events)
Spotify's paged library lists can return the same entry twice. The duplicate id reached `JobDO.start`, where ids are the item primary key, and creating the transfer failed. `validateSelection` now drops duplicate ids.

Known limits

  • A playlist the user deletes during a transfer now backs off until the 24 h job timeout instead of failing after eight retries (noted as `ponytail:` in `innertube.ts`).
  • Fixing a review item by hand when the last part is exactly full still fails on YouTube's cap.

Checks
`pnpm test` (72 worker, 4 web) and `pnpm --filter worker typecheck` pass. New tests: duplicate ids, `playlistNotFound` as a throttle, and a full playlist continuing into "(2)" with both parts verified.

Spotify's paged library lists can return the same playlist twice. The
duplicate id reached JobDO.start, where each id is the item primary key,
and job creation failed with a UNIQUE constraint error.
Reading a playlist a second after creating it, or its next page, can
answer 404 playlistNotFound until Google's replicas catch up. It was a
plain error, so every verify pass that hit it was reported and counted
towards the eight retries before provider_error. It is now a throttle:
back off and read again.
YouTube caps a playlist at 5,000 songs; the next add answers
FAILED_PRECONDITION "Maximum playlist size exceeded". It was a plain
error, so the job retried it eight times and failed with provider_error,
losing the rest of the transfer.

writeBatch now fills a playlist up to the cap and continues in
"<name> (2)", "(3)" and so on, the Liked Songs mirror included (likes
themselves are uncapped). Each track records the playlist it went into,
so verify reads every part and the re-drive puts a missing song back
into its own part. Jobs already running get the column on load,
backfilled from their single playlist.
@marctorrelles
marctorrelles marked this pull request as ready for review November 4, 2026 21:50
@marctorrelles
marctorrelles merged commit 9529dfb into main Nov 4, 2026
1 check passed
@marctorrelles
marctorrelles deleted the fix/crashyard-errors branch November 4, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant