DIYgod/RSSHub · error · Error
acct ${acct} not found
Error message
acct ${acct} not found What it means
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.
Source
Thrown at lib/routes/mastodon/utils.ts:128
headers: apiHeaders(site),
searchParams: {
q: acct,
type: 'accounts',
},
});
const [acctUser, acctHost] = acct.split('@').filter(Boolean);
let acctOnServer;
if (acctHost) {
acctOnServer = acctHost === acctDomain ? acctUser : acctUser + '@' + acctHost;
} else {
acctOnServer = acctUser;
}
const accountData = search_response.data.accounts.filter((item) => item.acct === acctOnServer);
if (accountData.length === 0) {
throw new Error(`acct ${acct} not found`);
}
return accountData[0].id;
});
return { site, account_id };
}
export default { apiHeaders, parseStatuses, getAccountStatuses, getAccountIdByAcct, allowSiteList };
View on GitHub (pinned to bed535e087)
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.
Defensive patterns
Strategy: validation
Validate before calling
function normalizeAcct(acct: string, acctDomain: string) {
const [user, host] = acct.split('@').filter(Boolean);
if (!user) {
throw new Error(`Invalid acct: ${acct}`);
}
return host && host !== acctDomain ? `${user}@${host}` : user;
} Type guard
interface MastodonAccount { id: string; acct: string; }
const isAccountArray = (v: unknown): v is MastodonAccount[] =>
Array.isArray(v) && v.every((a) => typeof a?.id === 'string' && typeof a?.acct === 'string'); Try / catch
try {
({ account_id } = await getAccountIdByAcct(acct));
} catch (e) {
if (/not found/i.test((e as Error).message)) {
// clear cached negative result and surface a clear 404 to the consumer
throw new Error(`Mastodon account not found: ${acct}. Verify the instance and username.`);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- ${data.errors[0].detail}
- Failed to retrieve manga meta from MangaDex API.
- ${tagResponse.msg}
- Invalid tagId
- response.error.message
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/153daf7d78360a09.
Report an issue: GitHub.