DIYgod/RSSHub · error · ConfigNotFoundError
Twitter API is not configured
Error message
Twitter API is not configured
What it means
ConfigNotFoundError from the Twitter developer-API client pool: after `init()` runs, if no valid consumer key/secret pair was pushed into `appClients`, getAppClient cannot return a client and throws. This is the runtime signal that the Twitter API v2 credentials are missing or all invalid.
Source
Thrown at lib/routes/twitter/api/developer-api/api.ts:66
}).readOnly,
isUserAuth: true,
});
} else {
appClients.push({
client: new TwitterApi({
appKey: consumerKey,
appSecret: consumerSecret,
}).readOnly,
isUserAuth: false,
});
}
}
};
export const getAppClient = async () => {
init();
if (!appClients.length) {
throw new ConfigNotFoundError('Twitter API is not configured');
}
index += 1;
const currentWrapper = appClients[index % appClients.length];
return currentWrapper.isUserAuth ? currentWrapper.client : await currentWrapper.client.appLogin();
};
const mapUserToLegacy = (user: Record<string, any>) =>
user
? {
id_str: user.id,
name: user.name,
screen_name: user.username,
description: user.description,
profile_image_url: user.profile_image_url,
profile_image_url_https: user.profile_image_url,
url: user.url,View on GitHub (pinned to bed535e087)
Solutions
- Apply for a Twitter developer project and create an app with v2 read access.
- Set `TWITTER_CONSUMER_KEY` and `TWITTER_CONSUMER_SECRET` (comma-separated for multiple clients) in RSSHub config and restart.
- Ensure secrets are non-empty for each key index; mismatches cause silent skips.
Defensive patterns
Strategy: validation
Validate before calling
init();
if (!appClients.length) { throw new ConfigNotFoundError('Set TWITTER_CONSUMER_KEY/TWITTER_CONSUMER_SECRET with at least one valid pair'); } Type guard
const hasClientPool = (a: unknown): a is { length: number } => Array.isArray(a) && a.length > 0; Prevention
- Validate consumer key/secret pairs at boot and warn on empty entries
- Use a secret manager for credentials
- Mark the route requireConfig so callers know
When it happens
Trigger: `config.twitter.consumerKey` or `config.twitter.consumerSecret` is unset, or every comma-separated pair has an empty secret (lines 37-39 `continue`), leaving appClients empty; getAppClient then throws on line 65-66.
Common situations: Self-hosted RSSHub without `TWITTER_CONSUMER_KEY`/`TWITTER_CONSUMER_SECRET`; keys revoked by X; only an auth token (web API) was configured but a route forced the developer API.
Related errors
- Tumblr RSS is disabled due to the lack of <a href="https://d
- Tumblr RSS is disabled due to the lack of <a href="https://d
- User ID is required for the v2 home timeline
- Twitter API is not configured
- Twitter RSS is disabled due to the lack of <a href="https://
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/162f66df8322318b.
Report an issue: GitHub.