DIYgod/RSSHub · error · ConfigNotFoundError
Twitter API is not configured
Error message
Twitter API is not configured
What it means
ConfigNotFoundError from the Twitter API entrypoint's fallback stub: when neither the developer API, web API, nor third-party API is enabled, the `api` object stays as the placeholder whose `init()` throws. It is the top-level signal that no Twitter backend is configured.
Source
Thrown at lib/routes/twitter/api/index.ts:28
const enableWebApi = config.twitter.authToken;
const enableDeveloperApi = config.twitter.consumerKey && config.twitter.consumerSecret;
type ApiItem = (id: string, params?: Record<string, any>) => Promise<Record<string, any>> | Record<string, any> | null;
let api: {
init: () => void;
getUser: ApiItem;
getUserTweets: ApiItem;
getUserTweetsAndReplies: ApiItem;
getUserMedia: ApiItem;
getUserLikes: ApiItem;
getUserTweet: ApiItem;
getSearch: ApiItem;
getList: ApiItem;
getHomeTimeline: ApiItem;
getHomeLatestTimeline: ApiItem;
} = {
init: () => {
throw new ConfigNotFoundError('Twitter API is not configured');
},
getUser: () => null,
getUserTweets: () => null,
getUserTweetsAndReplies: () => null,
getUserMedia: () => null,
getUserLikes: () => null,
getUserTweet: () => null,
getSearch: () => null,
getList: () => null,
getHomeTimeline: () => null,
getHomeLatestTimeline: () => null,
};
if (enableThirdPartyApi || enableWebApi) {
api = webApi;
} else if (enableDeveloperApi) {
api = devApi;
}View on GitHub (pinned to bed535e087)
Solutions
- Configure at least one Twitter backend: developer API (consumer key/secret), web API (auth token), or third-party API base URL.
- Restart RSSHub after setting the env vars so index.ts re-evaluates the enable flags.
- If using a docker compose setup, confirm the env vars are passed into the container.
Defensive patterns
Strategy: validation
Validate before calling
const enabled = config.twitter.consumerKey && config.twitter.consumerSecret || config.twitter.authToken || config.twitter.thirdPartyApi;
if (!enabled) throw new ConfigNotFoundError('No Twitter backend configured — set developer keys, an auth token, or a third-party API'); Type guard
const hasTwitterBackend = (c: { consumerKey?: string; consumerSecret?: string; authToken?: string; thirdPartyApi?: string }): boolean => Boolean((c.consumerKey && c.consumerSecret) || c.authToken || c.thirdPartyApi); Prevention
- Validate at least one Twitter backend is configured at boot
- Document all three backend options
- Restart RSSHub after setting env vars
When it happens
Trigger: None of `config.twitter.consumerKey`+`consumerSecret`, `config.twitter.authToken`, or `config.twitter.thirdPartyApi` is set, so the conditional upgrades in api/index.ts never replace the stub; calling `init()` (or any getter that triggers init) throws on line 27-28.
Common situations: Fresh RSSHub install with no Twitter env vars; all previously-set tokens were removed; the env var names changed between versions.
Related errors
- Twitter API is not configured
- Baidu Tieba RSS is disabled due to the lack of <a href="http
- 缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://do
- GitHub Discussions RSS is disabled due to the lack of <a hre
- GitHub follower RSS is disabled due to the lack of <a href="
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/387fc929382ed89d.
Report an issue: GitHub.