Skip to content

bug: lastfm-ts-api: Unable to parse LastFM API response to JSON #449

@kruoni

Description

@kruoni

Please check existing knowledge before opening an issue

Describe the Bug

Hello!

Since 0.11.0, lastFM sometimes has an error while scrobbling (probably because of a syntax error in the JS if my eyes aren't deceiving me), however retrying works without an issue and I don't really know what causes it.

What configuration types are you using for multi-scrobbler? Check all that apply.

Platform

Docker

Versions

  • jellyfin: 10.11.5
  • multi-scrobbler: 0.11.0

Logs

[2026-01-19 23:08:52.422 +0100] INFO   : [App] [Scrobblers] [Lastfm - KuoFM] Scrobbled (Backlog) => (Jellyfin) lost machine - myheart.mid @ 2026-01-19T23:01:41+01:00 (S)
[2026-01-19 23:08:52.420 +0100] DEBUG  : [App] [Scrobblers] [API - Lastfm - KuoFM] Raw Payload
    payload: {
      "artist": "lost machine",
      "track": "myheart.mid",
      "album": "FAUX_NOMBRES",
      "timestamp": 1768860101,
      "duration": 303.8480829,
      "albumArtist": "lost machine"
    }
[2026-01-19 23:08:52.232 +0100] DEBUG  : [App] [Scrobblers] [Lastfm - KuoFM] Jellyfin: lost machine - myheart.mid @ 2026-01-19T23:01:41+01:00 (S) => No existing scrobble matched with a score higher than 0
[2026-01-19 23:08:49.377 +0100] DEBUG  : [App] [Scrobblers] [Lastfm - KuoFM] Found 40 recent scrobbles
[2026-01-19 23:08:49.375 +0100] DEBUG  : [App] [Scrobblers] [API - Lastfm - KuoFM] Ignoring 'now playing' track returned from Last.fm client
    track: "myheart.mid"
    mbid: "da24f572-de1b-4e4d-bbeb-ae8a40bb13bb"
[2026-01-19 23:08:48.998 +0100] DEBUG  : [App] [Scrobblers] [Lastfm - KuoFM] Refreshing recent scrobbles
[2026-01-19 23:08:48.998 +0100] DEBUG  : [App] [Scrobblers] [Lastfm - KuoFM] [Upstream Refresh] Should refresh => newest queued scrobble playDate is newer than last refresh
[2026-01-19 23:08:48.990 +0100] INFO   : [App] [Scrobblers] [Lastfm - KuoFM] Scrobble processing started
[2026-01-19 23:08:44.255 +0100] DEBUG  : [App] [Sources] [Jellyfin - KuoFin] Last activity was at 23:08:44+01:00 | Next check in 10.00s | No new tracks discovered
[2026-01-19 23:08:44.249 +0100] DEBUG  : [App] [Sources] [Jellyfin - KuoFin] [Player F1181A69-C-iPhone-Discrete-kuo] 
Reported: STOPPED | Calculated: STOPPED | Stale: No | Orphaned: No | Player Updated At: 23:08:44+01:00 | Play Updated At: N/A
Listened For: 0s 
[2026-01-19 23:08:39.142 +0100] DEBUG  : [App] [Cache] [Auth] Saved cache to file
[2026-01-19 23:08:39.138 +0100] DEBUG  : [App] [Cache] [Scrobble] Saved cache to file
[2026-01-19 23:08:34.226 +0100] DEBUG  : [App] [Sources] [Jellyfin - KuoFin] Last activity was at 23:08:34+01:00 | Next check in 10.00s | No new tracks discovered
[2026-01-19 23:08:34.225 +0100] DEBUG  : [App] [Sources] [Jellyfin - KuoFin] [Player F1181A69-C-iPhone-Discrete-kuo] 
Reported: STOPPED | Calculated: STOPPED | Stale: No | Orphaned: No | Player Updated At: 23:08:34+01:00 | Play Updated At: N/A
Listened For: 0s 
[2026-01-19 23:08:33.989 +0100] INFO   : [App] [Scrobblers] [Lastfm - KuoFM] Scrobble processing retries (2) less than max processing retries (5), restarting processing after 15 second delay...
[2026-01-19 23:08:33.986 +0100] ERROR  : [App] [Scrobblers] [Lastfm - KuoFM] lastfm-ts-api: Unable to parse LastFM API response to JSON. API response is SyntaxError: Unexpected token '<', "<html>
<h"... is not valid JSON
Error: lastfm-ts-api: Unable to parse LastFM API response to JSON. API response is SyntaxError: Unexpected token '<', "<html>
<h"... is not valid JSON
    at <anonymous> (CWD/node_modules/lastfm-ts-api/src/api-request.ts:98:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async LastfmApiClient.callApi (CWD/src/backend/common/vendor/LastfmApiClient.ts:96:20)
    at async LastfmApiClient.getRecentTracks (CWD/src/backend/common/vendor/LastfmApiClient.ts:240:20)
    at async LastfmScrobbler.getScrobblesForRefresh (CWD/src/backend/scrobblers/LastfmScrobbler.ts:60:16)
    at async LastfmScrobbler.refreshScrobbles (CWD/src/backend/scrobblers/AbstractScrobbleClient.ts:343:28)
    at async LastfmScrobbler.doProcessing (CWD/src/backend/scrobblers/AbstractScrobbleClient.ts:769:25)
    at async LastfmScrobbler.startScrobbling (CWD/src/backend/scrobblers/AbstractScrobbleClient.ts:702:27)
[2026-01-19 23:08:33.985 +0100] ERROR  : [App] [Scrobblers] [Lastfm - KuoFM] Scrobble processing interrupted
[2026-01-19 23:08:33.935 +0100] DEBUG  : [App] [Scrobblers] [API - Lastfm - KuoFM] 
[2026-01-19 23:08:29.661 +0100] DEBUG  : [App] [Scrobblers] [Tealfm - KuoTeal] Updated queued scrobble cache
[2026-01-19 23:08:29.646 +0100] INFO   : [App] [Scrobblers] [Tealfm - KuoTeal] Scrobbled (Backlog) => (Jellyfin) lost machine - myheart.mid @ 2026-01-19T23:01:41+01:00 (S)
[2026-01-19 23:08:29.138 +0100] DEBUG  : [App] [Cache] [Scrobble] Saved cache to file
[2026-01-19 23:08:29.047 +0100] DEBUG  : [App] [Scrobblers] [Tealfm - KuoTeal] Jellyfin: lost machine - myheart.mid @ 2026-01-19T23:01:41+01:00 (S) => No existing scrobble matched with a score higher than 0
[2026-01-19 23:08:28.914 +0100] WARN   : [App] [Scrobblers] [API - Lastfm - KuoFM] API call was not good but recoverable (operation failed), retrying in 1.5 seconds...
[2026-01-19 23:08:26.052 +0100] DEBUG  : [App] [Scrobblers] [Tealfm - KuoTeal] Found 40 recent scrobbles
[2026-01-19 23:08:25.711 +0100] DEBUG  : [App] [Scrobblers] [Lastfm - KuoFM] Refreshing recent scrobbles
[2026-01-19 23:08:25.711 +0100] DEBUG  : [App] [Scrobblers] [Lastfm - KuoFM] [Upstream Refresh] Should refresh => newest queued scrobble playDate is newer than last refresh
[2026-01-19 23:08:25.706 +0100] DEBUG  : [App] [Scrobblers] [Tealfm - KuoTeal] Refreshing recent scrobbles
[2026-01-19 23:08:25.705 +0100] DEBUG  : [App] [Scrobblers] [Tealfm - KuoTeal] [Upstream Refresh] Should refresh => newest queued scrobble playDate is newer than last refresh
[2026-01-19 23:08:24.339 +0100] DEBUG  : [App] [Scrobblers] [Lastfm - KuoFM] [Now Playing] Now Playing matches and was last updated 89s ago (threshold 304.8480829s), not updating
[2026-01-19 23:08:24.220 +0100] DEBUG  : [App] [Scrobblers] [Tealfm - KuoTeal] Updated queued scrobble cache
[2026-01-19 23:08:24.209 +0100] DEBUG  : [App] [Scrobblers] [Lastfm - KuoFM] Updated queued scrobble cache
[2026-01-19 23:08:24.198 +0100] DEBUG  : [App] [Sources] [Jellyfin - KuoFin] Last activity was at 23:08:24+01:00 | Next check in 10.00s
[2026-01-19 23:08:24.178 +0100] INFO   : [App] [Sources] [Jellyfin - KuoFin] Discovered => lost machine - myheart.mid @ 2026-01-19T23:01:41+01:00 (S)
[2026-01-19 23:08:24.173 +0100] DEBUG  : [App] [Sources] [Jellyfin - KuoFin] [Player F1181A69-C-iPhone-Discrete-kuo] 
Reported: STOPPED | Calculated: STOPPED | Stale: No | Orphaned: No | Player Updated At: 23:08:24+01:00 | Play Updated At: N/A
Listened For: 0s 
[2026-01-19 23:08:24.168 +0100] VERBOSE: [App] [Sources] [Jellyfin - KuoFin] [Player F1181A69-C-iPhone-Discrete-kuo] (1a69ce46e481d67b4c577575e9c650ed) lost machine - myheart.mid added after met thresholds with tracked time of 291.68s (wanted 240s) and tracked percent of 96.00% (wanted 50%) and not matching any prior plays

Additional Context

Dont' have more logs for this one error, sorry.

[2026-01-19 18:15:35.568 +0100] ERROR  : [App] [Scrobblers] [Lastfm - KuoFM] Error occurred while trying to scrobble
Error: Error occurred while trying to scrobble
    at LastfmScrobbler.doProcessing (CWD/src/backend/scrobblers/AbstractScrobbleClient.ts:787:39)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async LastfmScrobbler.startScrobbling (CWD/src/backend/scrobblers/AbstractScrobbleClient.ts:702:27)
caused by: Error: Error received from Last.fm API
    at LastfmApiClient.scrobble (CWD/src/backend/common/vendor/LastfmApiClient.ts:355:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async LastfmScrobbler.doScrobble (CWD/src/backend/scrobblers/LastfmScrobbler.ts:90:28)
    at async LastfmScrobbler.doProcessing (CWD/src/backend/scrobblers/AbstractScrobbleClient.ts:777:51)
    at async LastfmScrobbler.startScrobbling (CWD/src/backend/scrobblers/AbstractScrobbleClient.ts:702:27)
caused by: Error: lastfm-ts-api: Unable to parse LastFM API response to JSON. API response is SyntaxError: Unexpected token '<', "
<html><hea"... is not valid JSON
    at <anonymous> (CWD/node_modules/lastfm-ts-api/src/api-request.ts:98:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async LastfmApiClient.callApi (CWD/src/backend/common/vendor/LastfmApiClient.ts:96:20)
    at async LastfmApiClient.scrobble (CWD/src/backend/common/vendor/LastfmApiClient.ts:309:30)
    at async LastfmScrobbler.doScrobble (CWD/src/backend/scrobblers/LastfmScrobbler.ts:90:28)
    at async LastfmScrobbler.doProcessing (CWD/src/backend/scrobblers/AbstractScrobbleClient.ts:777:51)
    at async LastfmScrobbler.startScrobbling (CWD/src/backend/scrobblers/AbstractScrobbleClient.ts:702:27)
[2026-01-19 18:15:35.564 +0100] ERROR  : [App] [Scrobblers] [Lastfm - KuoFM] Scrobble processing interrupted
[2026-01-19 18:15:35.558 +0100] ERROR  : [App] [Scrobblers] [Lastfm - KuoFM] Scrobble Error (Backlog)
    playInfo: "Toby Fox - A DARK ZONE @ 2026-01-19T18:13:09+01:00 (S)"
    payload: {
      "artist": "Toby Fox",
      "track": "A DARK ZONE",
      "album": "DELTARUNE Chapters 3+4 OST",
      "timestamp": 1768842789,
      "duration": 138,
      "albumArtist": "Toby Fox"
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions