DIYgod/RSSHub · error · ConfigNotFoundError

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

Error message

Mastodon 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

ConfigNotFoundError thrown inside getAccountIdByAcct when neither a host can be derived from the acct param (no '@host') nor from config.mastodon.apiHost/acctDomain. The function needs both site and acctDomain to perform the /api/v2/search lookup, so missing both is treated as an unconfigured route rather than a runtime fault.

Source

Thrown at lib/routes/mastodon/utils.ts:97

            method: 'get',
            url: account_url,
            headers: apiHeaders(site),
        });
        account_data = account_response.data;
    }

    return { account_data, data };
}

async function getAccountIdByAcct(acct) {
    const mastodonConfig = config.mastodon;

    // acctHost is from the acct param of the request, and acctDomain is from either acctHost or the config
    const acctHost = acct.split('@').filter(Boolean)[1];
    const site = mastodonConfig.apiHost || acctHost;
    const acctDomain = mastodonConfig.acctDomain || acctHost;
    if (!(site && acctDomain)) {
        throw new ConfigNotFoundError('Mastodon RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config</a>');
    }
    if (!config.feature.allow_user_supply_unsafe_domain && !allowSiteList.includes(site)) {
        throw new ConfigNotFoundError(`RSS for this domain is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true' or 'MASTODON_API_HOST' is set.`);
    }

    const search_url = `https://${site}/api/v2/search`;
    const cacheUid = `mastodon_acct_id/${site}/${acct}`;

    const account_id = await cache.tryGet(cacheUid, async () => {
        const search_response = await got({
            method: 'get',
            url: search_url,
            headers: apiHeaders(site),
            searchParams: {
                q: acct,
                type: 'accounts',
            },
        });

View on GitHub (pinned to bed535e087)

Solutions

  1. Set MASTODON_API_HOST (and optionally MASTODON_ACCT_DOMAIN) in the RSSHub environment.
  2. Call the route with the fully-qualified acct 'user@example.social' so acctHost is parsed.
  3. Verify the env var names against lib/config.ts (apiHost, acctDomain).
  4. Restart RSSHub after setting the env so config is re-read.
Defensive patterns

Strategy: validation

Validate before calling

function resolveAcctHost(acct: string) {
    const parts = acct.split('@').filter(Boolean);
    const host = parts[1] || config.mastodon.apiHost;
    if (!host) {
        throw new ConfigNotFoundError('Set MASTODON_API_HOST or pass user@instance');
    }
    return host;
}

Type guard

const hasMastodonHostConfig = (c: typeof config): boolean =>
    Boolean(c.mastodon?.apiHost && c.mastodon?.acctDomain);

Prevention

When it happens

Trigger: Calling the acct-based Mastodon route with a bare username (no '@instance') while MASTODON_API_HOST and MASTODON_ACCT_DOMAIN are both unset, leaving site and acctDomain undefined.

Common situations: Operator expected the instance to be inferred but did not set MASTODON_API_HOST; user passed 'user' instead of 'user@example.social'; env var typo (MASTODON_HOST vs MASTODON_API_HOST).

Related errors


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