{"record":{"id":"4b5e60ff5f671e28","repo":"DIYgod/RSSHub","slug":"mastodon-rss-is-disabled-due-to-the-lack-of-a-hre","errorCode":null,"errorMessage":"Mastodon RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>","messagePattern":"Mastodon 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":"ConfigNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/routes/mastodon/utils.ts","lineNumber":97,"sourceCode":"            method: 'get',\n            url: account_url,\n            headers: apiHeaders(site),\n        });\n        account_data = account_response.data;\n    }\n\n    return { account_data, data };\n}\n\nasync function getAccountIdByAcct(acct) {\n    const mastodonConfig = config.mastodon;\n\n    // acctHost is from the acct param of the request, and acctDomain is from either acctHost or the config\n    const acctHost = acct.split('@').filter(Boolean)[1];\n    const site = mastodonConfig.apiHost || acctHost;\n    const acctDomain = mastodonConfig.acctDomain || acctHost;\n    if (!(site && acctDomain)) {\n        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>');\n    }\n    if (!config.feature.allow_user_supply_unsafe_domain && !allowSiteList.includes(site)) {\n        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.`);\n    }\n\n    const search_url = `https://${site}/api/v2/search`;\n    const cacheUid = `mastodon_acct_id/${site}/${acct}`;\n\n    const account_id = await cache.tryGet(cacheUid, async () => {\n        const search_response = await got({\n            method: 'get',\n            url: search_url,\n            headers: apiHeaders(site),\n            searchParams: {\n                q: acct,\n                type: 'accounts',\n            },\n        });","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/mastodon/utils.ts#L79-L115","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Set MASTODON_API_HOST (and optionally MASTODON_ACCT_DOMAIN) in the RSSHub environment.","Call the route with the fully-qualified acct 'user@example.social' so acctHost is parsed.","Verify the env var names against lib/config.ts (apiHost, acctDomain).","Restart RSSHub after setting the env so config is re-read."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function resolveAcctHost(acct: string) {\n    const parts = acct.split('@').filter(Boolean);\n    const host = parts[1] || config.mastodon.apiHost;\n    if (!host) {\n        throw new ConfigNotFoundError('Set MASTODON_API_HOST or pass user@instance');\n    }\n    return host;\n}","typeGuard":"const hasMastodonHostConfig = (c: typeof config): boolean =>\n    Boolean(c.mastodon?.apiHost && c.mastodon?.acctDomain);","tryCatchPattern":null,"preventionTips":["Set MASTODON_API_HOST and MASTODON_ACCT_DOMAIN for any deployment using acct routes.","Require fully-qualified acct strings from feed consumers.","Restart RSSHub after setting mastodon env vars."],"tags":["mastodon","config","config-not-found","ssrf"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}