{"record":{"id":"d725854a38002a10","repo":"DIYgod/RSSHub","slug":"last-fm-rss-is-disabled-due-to-the-lack-of-a-href","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/loved.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.getlovedtracks&user=${user}&api_key=${api_key}&format=json`);\n    const data = response.data;\n    const list = data.lovedtracks.track;\n\n    ctx.state.data = {\n        title: `Loved Tracks by ${data.lovedtracks['@attr'].user} - Last.fm`,\n        link: `https://www.last.fm/user/${user}/loved`,\n        item: list.map((item) => ({\n            title: `${item.name} - ${item.artist.name}`,\n            author: item.artist.name,\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/loved.js#L1-L24","documentation":"Thrown by the Last.fm loved-tracks route (deprecated) when the Last.fm integration is not configured. The guard `!config.lastfm || !config.lastfm.api_key` fails and the route refuses to run, pointing at the route-specific config docs. An API key is mandatory because the route calls the audioscrobbler API directly.","triggerScenarios":"RSSHub deployed without a LASTFM_API_KEY (or the config block absent). Any request to the loved-tracks route triggers the throw before the API call.","commonSituations":"Fresh install without setting LASTFM_API_KEY in env/config; key removed during config cleanup; or running in an environment that strips the config block.","solutions":["Obtain an API key from https://www.last.fm/api/account/create and set LASTFM_API_KEY in RSSHub config.","Restart RSSHub after setting the env var so config.lastfm.api_key is populated.","Confirm config.lastfm is an object (not falsy) in your config file."],"exampleFix":"// config (env)\n// before\nLASTFM_API_KEY=\n// after\nLASTFM_API_KEY=<your_key>","handlingStrategy":"validation","validationCode":"if (!process.env.LASTFM_API_KEY) {\n  throw new Error('LASTFM_API_KEY missing — create one at https://www.last.fm/api/account/create');\n}","typeGuard":"const hasLastfmConfig = (c: { lastfm?: { api_key?: string } }): boolean =>\n  Boolean(c.lastfm && c.lastfm.api_key);","tryCatchPattern":"try { await rsshub('/lastfm/loved/' + user); }\ncatch (e) {\n  if (/disabled due to the lack/.test(e.message)) return configureAndRetry();\n  throw e;\n}","preventionTips":["Set LASTFM_API_KEY in env before first request.","The guard checks presence only — a revoked key fails downstream, not here."],"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"}