Skip to content

Full Privacy import fails validation when export contains podcasts/audiobooks with null metadata #582

@Rolucious

Description

@Rolucious

Description

When importing extended streaming history (Streaming_History_Audio_*.json files), the import fails with validation errors if the export contains podcast or audiobook entries that have null values for master_metadata_track_name and spotify_track_uri.

Steps to Reproduce

  1. Request extended streaming history from Spotify (Full Privacy Data)
  2. Receive files named Streaming_History_Audio_YYYY-YYYY_X.json
  3. Attempt to import via Settings → Full Privacy import
  4. Import fails with validation errors

Error Output

{
  "expected": "string",
  "code": "invalid_type",
  "path": [9898, "master_metadata_track_name"],
  "message": "Invalid input: expected string, received undefined"
}

Root Cause

Spotify's export includes podcast/audiobook entries like this:

{
  "ts": "2024-01-15T10:00:00Z",
  "ms_played": 120000,
  "spotify_track_uri": null,
  "master_metadata_track_name": null,
  "master_metadata_album_artist_name": null,
  "episode_name": "Podcast Episode Title",
  "spotify_episode_uri": "spotify:episode:xxxxx"
}

The current validation in fullPrivacyFileSchema requires all records to have non-null master_metadata_track_name and spotify_track_uri, which causes the entire import to fail when any podcast/audiobook entries are present.

Expected Behavior

The importer should skip records that are podcasts/audiobooks (identifiable by null track metadata but present episode metadata) rather than failing the entire import.

Suggested Fix

In apps/server/src/tools/importers/full_privacy.ts, filter out records where master_metadata_track_name is null before validation, or make the schema more lenient and filter during processing.

Workaround

Pre-process the JSON files to filter out records where master_metadata_track_name is null:

import json
data = json.load(open('Streaming_History_Audio_*.json'))
cleaned = [r for r in data if r.get('master_metadata_track_name') is not None]
json.dump(cleaned, open('cleaned.json', 'w'))

Environment

  • Your Spotify version: latest (Dec 2025 image)
  • Spotify export format: Extended streaming history (2025 format)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions