{"record":{"id":"77ee8f411833b3e1","repo":"DIYgod/RSSHub","slug":"last-fm-rss-is-disabled-due-to-the-lack-of-a-href-77ee8f","errorCode":null,"errorMessage":"Last.fm RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>","messagePattern":"Last\\.fm RSS is disabled due to the lack of <a href=\"https://docs\\.rsshub\\.app/deploy/config#route-specific-configurations\">relevant config</a>","errorType":"exception","errorClass":null,"httpStatus":503,"severity":"error","filePath":"lib/routes-deprecated/lastfm/recent.js","lineNumber":6,"sourceCode":"const got = require('@/utils/got');\nconst config = require('@/config').value;\n\nmodule.exports = async (ctx) => {\n    if (!config.lastfm || !config.lastfm.api_key) {\n        throw new Error('Last.fm RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>');\n    }\n\n    const user = ctx.params.user;\n    const api_key = config.lastfm.api_key;\n\n    const response = await got(`http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=${user}&api_key=${api_key}&format=json`);\n    const data = response.data;\n    const list = data.recenttracks.track;\n\n    ctx.state.data = {\n        title: `Recent Tracks by ${data.recenttracks['@attr'].user} - Last.fm`,\n        link: `https://www.last.fm/user/${user}/library`,\n        item: list.map((item) => ({\n            title: `${item.name} - ${item.artist['#text']}`,\n            author: item.artist['#text'],\n            description: `<img src=\"${item.image.at(-1)['#text']}\" />`,\n            pubDate: new Date(item.date.uts * 1000),\n            link: item.url,","sourceCodeStart":1,"sourceCodeEnd":24,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes-deprecated/lastfm/recent.js#L1-L24","documentation":"Thrown by the Last.fm recent-tracks route (deprecated) under the same missing-config guard as the loved-tracks route: config.lastfm or config.lastfm.api_key absent. The route needs the key to call user.getrecenttracks on the audioscrobbler API.","triggerScenarios":"Any request to the recent-tracks route when LASTFM_API_KEY is unset; the guard throws before the HTTP call.","commonSituations":"Deployment without LASTFM_API_KEY, key rotated/revoked at Last.fm but not updated in config, or config.lastfm block misnamed.","solutions":["Set LASTFM_API_KEY (create one at https://www.last.fm/api/account/create) and restart RSSHub.","Verify config.lastfm.api_key is non-empty at runtime.","If the key is invalid (not missing), note this guard will NOT catch it — Last.fm returns an error payload downstream instead."],"exampleFix":"// before\nconfig.lastfm = undefined\n// after\nconfig.lastfm = { api_key: process.env.LASTFM_API_KEY }","handlingStrategy":"validation","validationCode":"if (!process.env.LASTFM_API_KEY) {\n  throw new Error('Configure LASTFM_API_KEY to use Last.fm recent tracks');\n}","typeGuard":"const hasLastfmConfig = (c: { lastfm?: { api_key?: string } }): boolean =>\n  Boolean(c.lastfm?.api_key);","tryCatchPattern":"try { await rsshub('/lastfm/recent/' + user); }\ncatch (e) {\n  if (/disabled due to the lack/.test(e.message)) return promptConfig();\n  throw e;\n}","preventionTips":["Reuse the same key for all three Last.fm routes.","Restart RSSHub after setting the env var."],"tags":["rsshub","missing-config","api-key","lastfm","deprecated-route"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}