DIYgod/RSSHub · error

Last.fm RSS is disabled due to the lack of <a href="https://

Error message

Last.fm RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config</a>

What it means

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.

Source

Thrown at lib/routes-deprecated/lastfm/loved.js:6

const got = require('@/utils/got');
const config = require('@/config').value;

module.exports = async (ctx) => {
    if (!config.lastfm || !config.lastfm.api_key) {
        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>');
    }

    const user = ctx.params.user;
    const api_key = config.lastfm.api_key;

    const response = await got(`http://ws.audioscrobbler.com/2.0/?method=user.getlovedtracks&user=${user}&api_key=${api_key}&format=json`);
    const data = response.data;
    const list = data.lovedtracks.track;

    ctx.state.data = {
        title: `Loved Tracks by ${data.lovedtracks['@attr'].user} - Last.fm`,
        link: `https://www.last.fm/user/${user}/loved`,
        item: list.map((item) => ({
            title: `${item.name} - ${item.artist.name}`,
            author: item.artist.name,
            description: `<img src="${item.image.at(-1)['#text']}" />`,
            pubDate: new Date(item.date.uts * 1000),
            link: item.url,

View on GitHub (pinned to bed535e087)

Solutions

  1. Obtain an API key from https://www.last.fm/api/account/create and set LASTFM_API_KEY in RSSHub config.
  2. Restart RSSHub after setting the env var so config.lastfm.api_key is populated.
  3. Confirm config.lastfm is an object (not falsy) in your config file.

Example fix

// config (env)
// before
LASTFM_API_KEY=
// after
LASTFM_API_KEY=<your_key>
Defensive patterns

Strategy: validation

Validate before calling

if (!process.env.LASTFM_API_KEY) {
  throw new Error('LASTFM_API_KEY missing — create one at https://www.last.fm/api/account/create');
}

Type guard

const hasLastfmConfig = (c: { lastfm?: { api_key?: string } }): boolean =>
  Boolean(c.lastfm && c.lastfm.api_key);

Try / catch

try { await rsshub('/lastfm/loved/' + user); }
catch (e) {
  if (/disabled due to the lack/.test(e.message)) return configureAndRetry();
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/d725854a38002a10. Report an issue: GitHub.