DIYgod/RSSHub · error · Error

Failed to retrieve user follows from MangaDex API.

Error message

Failed to retrieve user follows from MangaDex API.

What it means

Thrown when GET /manga/status (the logged-in user's reading-status map) returns no response.data.statuses. Cached under mangadex:user-follow-<followType> for routeExpire and filtered by statusMap[followType] (reading/re/on_hold/etc.). Requires a Bearer token.

Source

Thrown at lib/routes/mangadex/user/follows.ts:114

    const { type } = ctx.req.param();

    const followType = (type || 'reading') as FollowType;

    const accessToken = await getToken();

    const statuses = (await cache.tryGet(
        `mangadex:user-follow-${followType}`,
        async () => {
            const response = await got.get(userFollowUrl, {
                headers: {
                    Authorization: `Bearer ${accessToken}`,
                    'User-Agent': config.trueUA,
                },
            });

            const statuses = response?.data?.statuses;
            if (!statuses) {
                throw new Error('Failed to retrieve user follows from MangaDex API.');
            }

            return statuses;
        },
        config.cache.routeExpire,
        false
    )) as Record<string, string>;

    const mangaIds = filterByValue(statuses, statusMap[followType]);

    const mangaMetaMap = await getMangaMetaByIds(mangaIds);

    const mangaChapters = await Promise.all(mangaIds.map((id) => getMangaChapters(id, undefined, 10)));

    const mangas = mangaChapters.flatMap((chapters, index) => {
        const mangaMeta = mangaMetaMap.get(mangaIds[index]);
        return chapters.map((chapter) => ({
            title: mangaMeta?.title ?? 'Unknown',

View on GitHub (pinned to bed535e087)

Solutions

  1. Set MANGADEX_* credentials and flush mangadex:access-token.
  2. Confirm the account has manga marked with the requested followType at mangadex.org.
  3. Use a valid followType (reading, re_on_hold, plan_to_read, dropped, completed).
  4. Clear cache key mangadex:user-follow-<followType>.
Defensive patterns

Strategy: validation

Validate before calling

const VALID_FOLLOW_TYPES = ['reading','re_on_hold','plan_to_read','dropped','completed'];
if (!VALID_FOLLOW_TYPES.includes(followType)) {
    throw new Error(`Invalid followType: ${followType}`);
}
if (!config.mangadex.clientId || !config.mangadex.clientSecret) {
    throw new ConfigNotFoundError('User follows require MANGADEX_* auth');
}

Type guard

const isStatusesResponse = (v: unknown): v is { statuses: Record<string, string> } =>
    typeof v === 'object' && v !== null && typeof (v as any).statuses === 'object';

Prevention

When it happens

Trigger: GET https://api.mangadex.org/manga/status with Authorization: Bearer <accessToken> returning no statuses field: invalid/expired token, user has no reading-status entries, or followType maps to a status the user has none of.

Common situations: Auth misconfigured; access token stale; user has never marked any manga with the requested status; cached empty/error result; followType param not in statusMap so statusMap[followType] is undefined and filterByValue returns nothing (though that path returns empty rather than throwing).

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/72a8148da07da76c. Report an issue: GitHub.