DIYgod/RSSHub · warning · InvalidParameterError
User not found
Error message
User not found
What it means
InvalidParameterError from the Twitter mobile-API cacheTryGet helper: getUserID resolved no rest_id for the given id/username, so the account does not exist (or is suspended) from the mobile API's perspective. It throws before attempting the cached operation.
Source
Thrown at lib/routes/twitter/api/mobile-api/api.ts:239
if (id.startsWith('+')) {
return userByRestId(id.slice(1));
}
return userByScreenName(id);
};
const getUserData = (id) => cache.tryGet(`twitter-userdata-${id}`, () => userByAuto(id));
const getUserID = async (id) => {
const userData = await getUserData(id);
return (userData.data?.user || userData.data?.user_result)?.result?.rest_id;
};
const getUser = async (id) => {
const userData = await getUserData(id);
return (userData.data?.user || userData.data?.user_result)?.result?.legacy;
};
const cacheTryGet = async (_id, params, func) => {
const id = await getUserID(_id);
if (id === undefined) {
throw new InvalidParameterError('User not found');
}
const funcName = func.name;
const paramsString = JSON.stringify(params);
return cache.tryGet(`twitter:${id}:${funcName}:${paramsString}`, () => func(id, params), config.cache.routeExpire, false);
};
// returns:
// 1. nothing for some users
// 2. HOT tweets for the other users, instead of the LATEST ones
const _getUserTweets = (id, params = {}) => cacheTryGet(id, params, getUserTweetsByID);
// workaround for the above issue:
// 1. getUserTweetsAndReplies return LATEST tweets and replies, which requires filtering
// a. if one replies a lot (e.g. elonmusk), there is sometimes no tweets left after filtering, caching may help
// 2. getUserMedia return LATEST media tweets, which is a good plus
const getUserTweets = async (id, params = {}) => {
let tweets: any[] = [];
const rest_id = await getUserID(id);
await Promise.all(View on GitHub (pinned to bed535e087)
Solutions
- Verify the handle exists on x.com.
- Confirm the mobile API auth cookies are still valid (an anonymous call returns degraded data).
- Retry after rotating/re-authenticating the mobile session if responses are uniformly empty.
Defensive patterns
Strategy: try-catch
Validate before calling
const id = await getUserID(_id);
if (id === undefined) throw new InvalidParameterError(`Twitter user not found: ${_id}`); Type guard
const isRestId = (v: unknown): v is string => typeof v === 'string' && /^\d+$/.test(v);
Try / catch
try { return await cacheTryGet(_id, params, func); }
catch (e) { if (e instanceof InvalidParameterError && /User not found/.test(e.message)) { /* re-auth mobile session if responses are uniformly empty */ } throw e; } Prevention
- Keep mobile-API session cookies fresh
- Validate handle format before lookup
- Distinguish suspended vs unknown in error mapping
When it happens
Trigger: A mobile-API function is called with a handle that yields no `userData.data.user.user_result.result.rest_id` — line 240 returns undefined, line 242-243 throws 'User not found'.
Common situations: Username typo, suspended/deleted account, or the mobile API endpoint is being challenged (logged-out) and returns no user payload; a stale negative cache could also be involved though this path recomputes.
Related errors
- User not found
- ${userOrError.__typename}
- Username does not exist
- Username does not exist
- Tweet ID is required
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/bfffec7ef6f35094.
Report an issue: GitHub.