DIYgod/RSSHub · error · Error

${data.message}

Error message

${data.message}

What it means

Thrown by the MIUI community user-posts route when the upstream api.vip.miui.com announce-list endpoint returns data.code !== 200. The handler passes the upstream API's own `data.message` straight through as the error text, so the message you see is whatever Xiaomi's API returned (rate-limit, invalid uid, auth required, etc.). It is a bare `throw new Error(data.message)`.

Source

Thrown at lib/routes/miui/community/user.ts:67

            authorName = item.author.name;
            return {
                title: item.title || `${authorName} 的动态`,
                description: item.textContent,
                pubDate: new Date(item.createTime).toUTCString(),
                author: item.author.name,
                link: `${pageRoot}?postId=${item.id}`,
                image: item.pic || item.cover || '',
            };
        });
        return {
            title: `小米社区 - ${authorName} 的发帖`,
            link: userLink,
            description: `${authorName} 的发帖`,
            item: items,
            language: 'zh-CN',
        };
    }
    throw new Error(data.message);
}

View on GitHub (pinned to bed535e087)

Solutions

  1. Verify the uid at https://web.vip.miui.com/page/info/mio/mio/homePage?uid=<uid> — if the profile is empty/404 the uid is wrong.
  2. Reproduce the upstream call with curl (including the Referer header) and read data.message to learn the exact upstream reason.
  3. If the API now requires auth, supply the necessary cookie/token header (mirror how a logged-in browser requests the page).
  4. Retry after a short delay if the message indicates a transient rate-limit.

Example fix

// before
if (data.code === 200) {
    // ... build feed
}
throw new Error(data.message);

// after — include the code and a hint for unknown messages
if (data.code === 200) {
    // ... build feed
}
throw new Error(`MIUI API error (code ${data.code}): ${data.message || 'unknown error for uid ' + uid}`);
Defensive patterns

Strategy: try-catch

Validate before calling

const uid = ctx.req.param('uid');
if (!/^\d+$/.test(uid)) {
    throw new InvalidParameterError(`uid must be numeric; got: ${uid}`);
}

Type guard

function isMiuiOk(data: any): data is { code: 200; entity: { records: any[] } } {
    return data?.code === 200 && Array.isArray(data?.entity?.records);
}

Try / catch

try {
    const { data } = await got({ method: 'get', url: apiLink, headers: { Referer: userLink } });
    if (data.code !== 200) {
        throw new Error(`MIUI API error (code ${data.code}): ${data.message}`);
    }
    // ... build feed
} catch (e) {
    // rethrow typed, or fall back to a stale cached feed if available
    throw e;
}

Prevention

When it happens

Trigger: The handler GETs api/community/user/announce/list?uid=<uid>&limit=10 with a Referer. If data.code is anything other than 200 (e.g. 401 auth required, 429 rate-limited, 400 invalid uid, or an internal error code), it throws the API's message.

Common situations: An invalid or non-existent uid; MIUI's API now requires a login cookie/token for this endpoint; the source IP is rate-limited or region-blocked; transient upstream outage returning an error envelope.

Related errors


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