{"record":{"id":"153daf7d78360a09","repo":"DIYgod/RSSHub","slug":"acct-acct-not-found","errorCode":null,"errorMessage":"acct ${acct} not found","messagePattern":"acct (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/mastodon/utils.ts","lineNumber":128,"sourceCode":"            headers: apiHeaders(site),\n            searchParams: {\n                q: acct,\n                type: 'accounts',\n            },\n        });\n        const [acctUser, acctHost] = acct.split('@').filter(Boolean);\n        let acctOnServer;\n\n        if (acctHost) {\n            acctOnServer = acctHost === acctDomain ? acctUser : acctUser + '@' + acctHost;\n        } else {\n            acctOnServer = acctUser;\n        }\n\n        const accountData = search_response.data.accounts.filter((item) => item.acct === acctOnServer);\n\n        if (accountData.length === 0) {\n            throw new Error(`acct ${acct} not found`);\n        }\n        return accountData[0].id;\n    });\n    return { site, account_id };\n}\n\nexport default { apiHeaders, parseStatuses, getAccountStatuses, getAccountIdByAcct, allowSiteList };\n","sourceCodeStart":110,"sourceCodeEnd":136,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/mastodon/utils.ts#L110-L136","documentation":"Plain Error thrown inside the cache.tryGet callback of getAccountIdByAcct when the /api/v2/search response contains no account whose acct field matches the computed acctOnServer string. The match is strict (exact equality after normalizing local-vs-remote host), so a near-match or an empty search result triggers this.","triggerScenarios":"GET https://<site>/api/v2/search?q=<acct>&type=accounts returns accounts, but none with acct === acctOnServer (e.g. the user exists on a different instance, the search was rate-limited to partial results, the account is suspended/deleted, or the acctDomain normalization produced the wrong acctOnServer).","commonSituations":"Wrong username in the route; account is remote but the configured acctDomain makes acctOnServer compare against the wrong string; search endpoint returned 0 results due to instance search-index lag or rate limiting; MASTODON_ACCT_DOMAIN mismatch with the actual web domain.","solutions":["Verify the account exists by searching for it directly on <site>.","Set MASTODON_ACCT_DOMAIN to match the instance's web domain when it differs from the API host (some instances split api vs web domains).","Clear the cache key mastodon_acct_id/<site>/<acct> to force a fresh search.","Supply the fully-qualified acct 'user@example.social' to remove ambiguity."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function normalizeAcct(acct: string, acctDomain: string) {\n    const [user, host] = acct.split('@').filter(Boolean);\n    if (!user) {\n        throw new Error(`Invalid acct: ${acct}`);\n    }\n    return host && host !== acctDomain ? `${user}@${host}` : user;\n}","typeGuard":"interface MastodonAccount { id: string; acct: string; }\nconst isAccountArray = (v: unknown): v is MastodonAccount[] =>\n    Array.isArray(v) && v.every((a) => typeof a?.id === 'string' && typeof a?.acct === 'string');","tryCatchPattern":"try {\n    ({ account_id } = await getAccountIdByAcct(acct));\n} catch (e) {\n    if (/not found/i.test((e as Error).message)) {\n        // clear cached negative result and surface a clear 404 to the consumer\n        throw new Error(`Mastodon account not found: ${acct}. Verify the instance and username.`);\n    }\n    throw e;\n}","preventionTips":["Always pass the fully-qualified acct (user@instance) to remove normalization ambiguity.","Set MASTODON_ACCT_DOMAIN when the web domain differs from the API host.","Clear the mastodon_acct_id cache key if a stale negative result persists."],"tags":["mastodon","api","validation","network"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}