DIYgod/RSSHub · warning · Error
username ${username} not found
Error message
username ${username} not found What it means
Thrown by the Misskey user-lookup helper when the /api/users/search-by-username-and-host call succeeds but none of the returned results have a username matching the requested one. The result is cached, so this error is also cached — repeated identical lookups will fail fast from cache until the cache entry expires.
Source
Thrown at lib/routes/misskey/utils.tsx:117
async function getUserTimelineByUsername(username, site, { withRenotes = false, mediaOnly = false }) {
const searchUrl = `https://${site}/api/users/search-by-username-and-host`;
const cacheUid = `misskey_username/${site}/${username}`;
const userData = (await cache.tryGet(cacheUid, async () => {
const searchResponse = await got({
method: 'post',
url: searchUrl,
json: {
username,
host: site,
detail: true,
limit: 1,
},
});
const user = searchResponse.data.find((item) => item.username === username);
if (!user) {
throw new Error(`username ${username} not found`);
}
return user;
})) as MisskeyUser;
const accountId = userData.id;
const avatarUrl = userData.avatarUrl;
// https://misskey.io/api-doc#tag/users/operation/users___notes
const usernotesUrl = `https://${site}/api/users/notes`;
const usernotesResponse = await got({
method: 'post',
url: usernotesUrl,
json: {
userId: accountId,
withChannelNotes: true,
withRenotes,
withReplies: !mediaOnly, // Disable replies if mediaOnly is true
withFiles: mediaOnly,View on GitHub (pinned to bed535e087)
Solutions
- Verify the username and site by opening https://{site}/@{username} in a browser.
- Perform a case-insensitive match: item.username.toLowerCase() === username.toLowerCase().
- Ensure the site is in the supported allowSiteList (misskey.io, madost.one, mk.nixnet.social).
- If the user is remote, you may need to search with their full handle, but this helper only supports same-instance users.
Example fix
// before
const user = searchResponse.data.find((item) => item.username === username);
if (!user) throw new Error(`username ${username} not found`);
// after — case-insensitive match + clearer message
const lower = username.toLowerCase();
const user = searchResponse.data.find((item) => item.username?.toLowerCase() === lower);
if (!user) {
throw new Error(`Username '${username}' not found on ${site}. Verify the user exists on this instance.`);
} Defensive patterns
Strategy: type-guard
Validate before calling
const username = ctx.req.param('username').toLowerCase();
const site = ctx.req.param('site');
if (!/^[a-z0-9_]{1,64}$/.test(username)) {
throw new InvalidParameterError(`Invalid Misskey username '${username}'`);
}
// Match case-insensitively in the search result
const user = searchResponse.data.find((item) => item.username?.toLowerCase() === username); Type guard
function findMisskeyUser(results: MisskeyUser[], username: string): MisskeyUser | undefined {
const lower = username.toLowerCase();
return results.find((item) => item.username?.toLowerCase() === lower);
} Prevention
- Normalize the username to lowercase before search and before comparison — Misskey usernames are case-insensitive.
- Verify the user exists on the specified instance by browsing their profile first.
- Remember the result is cached — a not-found may persist until cache expiry; bust the cache if you fix a typo.
- Only same-instance users are supported; remote users require a different lookup.
When it happens
Trigger: Requesting a Misskey feed for a username that does not exist on the specified instance (site). The username is correct but belongs to a remote user (host mismatch — the search filters by host: site). Case sensitivity: Misskey usernames are case-insensitive but the exact-match filter item.username === username may miss different-case entries.
Common situations: Typo in the username. The user moved to a different instance. The user is remote and the search didn't resolve them. The instance is not in allowSiteList and federation lookup fails silently. Case mismatch between the supplied username and the stored one.
Related errors
- Douban 返回数据结构异常,可能触发反爬或限频。${details ? `上游信息:${details}` : ''
- Douban 返回空数据,可能触发反爬或限频。请稍后重试。
- ${tagResponse.msg}
- Invalid tagId
- Fortnite API responded with ${statusMessage} for ${apiUrl}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/d26775487651fde7.
Report an issue: GitHub.