Album & Track Management Fixes
Hotfix Release — Critical bug fixes for album and track management released immediately following the December 2025 Production Launch.
Summary
This hotfix addresses several issues discovered during the production launch, primarily affecting album creation and track management workflows.Bug Fixes
Channel Cache Invalidation
Issue: Newly uploaded tracks were not appearing on certain channel pages (like/discover) despite being visible on others (/channel/new-beats).
Cause: The Redis cache invalidation was using incorrect key patterns. Channel content caches use the format channels.<id>.<updated_at>.<params>, but the invalidation code was searching for patterns like tracks:* and homepage:*.
Fix:
- Updated cache invalidation to use the correct
*channels.*pattern - Added
touchTrackChannels()to update channel timestamps when tracks are created/updated - Uses proper Redis connection (
cachedatabase) with correct prefix handling
Album Creation 500 Error
Issue: Creating an album with existing tracks caused a 500 Internal Server Error with message:Method Illuminate\Database\Eloquent\Collection::users does not exist.
Cause: The determineOwnerId() method expected artist IDs as integers but received artist objects in array format (e.g., {id: 123, name: 'Artist'}). When passed to Artist::find(), this returned a Collection instead of a single model.
Fix: Updated both CrupdateAlbum.php and CrupdateTrack.php to properly extract artist IDs from array format using Arr::get($artist, 'id').
Duplicate Track Creation
Issue: Adding existing tracks to an album created duplicate copies of those tracks instead of associating the existing tracks. Cause: ThesaveTracks() method only searched for tracks within the album’s current tracks ($savedTracks). Tracks not already in the album weren’t found, causing the system to create new tracks.
Fix: Updated lookup logic to first check album tracks, then fall back to database lookup for existing tracks being added:
Track Metadata Loss
Issue: Adding existing tracks to an album removed their associated artists, tags, and genres. Cause: TheCrupdateTrack::execute() method was falling back to the album’s artists when track data didn’t include artists, then replacing all track artists with album artists. Similar behavior affected tags and genres.
Fix: Added explicit checks to only update relationships when they’re explicitly provided in the request data:
Album Metadata Preservation
Issue: Similar to tracks, updating albums could inadvertently clear artists, tags, or genres if not explicitly provided in the update request. Fix: Applied the same explicit-check pattern toCrupdateAlbum.php:
- Artists only updated when
artistskey is present - Tags only synced when
tagskey is present - Genres only synced when
genreskey is present
Notification Crash Prevention
Issue: Creating an album without artists would cause a null pointer exception when attempting to notify followers. Cause: The code called$album->artists->first()->followers() without checking if artists existed.
Fix: Added null checks before sending notifications:
Files Changed
| File | Changes |
|---|---|
app/Services/Tracks/CrupdateTrack.php | Cache invalidation, artist ID extraction, metadata preservation |
app/Services/Albums/CrupdateAlbum.php | Track lookup fix, metadata preservation, null checks |
Verification
After applying these fixes:- New tracks appear immediately on all channel pages including
/discover - Albums can be created with existing tracks without errors
- Existing tracks maintain their artists, tags, and genres when added to albums
- Albums maintain their metadata during updates
- Album creation works correctly even with edge cases