{"record":{"id":"00e5c80dd5ab1bb0","repo":"DIYgod/RSSHub","slug":"data-message","errorCode":null,"errorMessage":"${data.message}","messagePattern":"\\$\\{data\\.message\\}","errorType":"exception","errorClass":"Error","httpStatus":503,"severity":"error","filePath":"lib/routes/miui/community/user.ts","lineNumber":67,"sourceCode":"            authorName = item.author.name;\n            return {\n                title: item.title || `${authorName} 的动态`,\n                description: item.textContent,\n                pubDate: new Date(item.createTime).toUTCString(),\n                author: item.author.name,\n                link: `${pageRoot}?postId=${item.id}`,\n                image: item.pic || item.cover || '',\n            };\n        });\n        return {\n            title: `小米社区 - ${authorName} 的发帖`,\n            link: userLink,\n            description: `${authorName} 的发帖`,\n            item: items,\n            language: 'zh-CN',\n        };\n    }\n    throw new Error(data.message);\n}\n","sourceCodeStart":49,"sourceCodeEnd":69,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/miui/community/user.ts#L49-L69","documentation":"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)`.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Reproduce the upstream call with curl (including the Referer header) and read data.message to learn the exact upstream reason.","If the API now requires auth, supply the necessary cookie/token header (mirror how a logged-in browser requests the page).","Retry after a short delay if the message indicates a transient rate-limit."],"exampleFix":"// before\nif (data.code === 200) {\n    // ... build feed\n}\nthrow new Error(data.message);\n\n// after — include the code and a hint for unknown messages\nif (data.code === 200) {\n    // ... build feed\n}\nthrow new Error(`MIUI API error (code ${data.code}): ${data.message || 'unknown error for uid ' + uid}`);","handlingStrategy":"try-catch","validationCode":"const uid = ctx.req.param('uid');\nif (!/^\\d+$/.test(uid)) {\n    throw new InvalidParameterError(`uid must be numeric; got: ${uid}`);\n}","typeGuard":"function isMiuiOk(data: any): data is { code: 200; entity: { records: any[] } } {\n    return data?.code === 200 && Array.isArray(data?.entity?.records);\n}","tryCatchPattern":"try {\n    const { data } = await got({ method: 'get', url: apiLink, headers: { Referer: userLink } });\n    if (data.code !== 200) {\n        throw new Error(`MIUI API error (code ${data.code}): ${data.message}`);\n    }\n    // ... build feed\n} catch (e) {\n    // rethrow typed, or fall back to a stale cached feed if available\n    throw e;\n}","preventionTips":["Validate uid is numeric before the request.","Map known upstream codes (auth/rate-limit) to typed errors with actionable messages.","Consider caching the last successful feed to serve during transient upstream errors."],"tags":["upstream-error","api-passthrough","authentication","rate-limit","miui"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}