{"record":{"id":"d26775487651fde7","repo":"DIYgod/RSSHub","slug":"username-username-not-found","errorCode":null,"errorMessage":"username ${username} not found","messagePattern":"username (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"lib/routes/misskey/utils.tsx","lineNumber":117,"sourceCode":"async function getUserTimelineByUsername(username, site, { withRenotes = false, mediaOnly = false }) {\n    const searchUrl = `https://${site}/api/users/search-by-username-and-host`;\n    const cacheUid = `misskey_username/${site}/${username}`;\n\n    const userData = (await cache.tryGet(cacheUid, async () => {\n        const searchResponse = await got({\n            method: 'post',\n            url: searchUrl,\n            json: {\n                username,\n                host: site,\n                detail: true,\n                limit: 1,\n            },\n        });\n        const user = searchResponse.data.find((item) => item.username === username);\n\n        if (!user) {\n            throw new Error(`username ${username} not found`);\n        }\n        return user;\n    })) as MisskeyUser;\n\n    const accountId = userData.id;\n    const avatarUrl = userData.avatarUrl;\n\n    // https://misskey.io/api-doc#tag/users/operation/users___notes\n    const usernotesUrl = `https://${site}/api/users/notes`;\n    const usernotesResponse = await got({\n        method: 'post',\n        url: usernotesUrl,\n        json: {\n            userId: accountId,\n            withChannelNotes: true,\n            withRenotes,\n            withReplies: !mediaOnly, // Disable replies if mediaOnly is true\n            withFiles: mediaOnly,","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/misskey/utils.tsx#L99-L135","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nconst user = searchResponse.data.find((item) => item.username === username);\nif (!user) throw new Error(`username ${username} not found`);\n\n// after — case-insensitive match + clearer message\nconst lower = username.toLowerCase();\nconst user = searchResponse.data.find((item) => item.username?.toLowerCase() === lower);\nif (!user) {\n    throw new Error(`Username '${username}' not found on ${site}. Verify the user exists on this instance.`);\n}","handlingStrategy":"type-guard","validationCode":"const username = ctx.req.param('username').toLowerCase();\nconst site = ctx.req.param('site');\nif (!/^[a-z0-9_]{1,64}$/.test(username)) {\n    throw new InvalidParameterError(`Invalid Misskey username '${username}'`);\n}\n// Match case-insensitively in the search result\nconst user = searchResponse.data.find((item) => item.username?.toLowerCase() === username);","typeGuard":"function findMisskeyUser(results: MisskeyUser[], username: string): MisskeyUser | undefined {\n    const lower = username.toLowerCase();\n    return results.find((item) => item.username?.toLowerCase() === lower);\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["api","user-lookup","misskey","case-sensitivity","federation"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}