{"record":{"id":"a1a491e9f1419d72","repo":"DIYgod/RSSHub","slug":"error-a1a491","errorCode":null,"errorMessage":"未获取到数据！","messagePattern":"未获取到数据！","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/mihoyo/bbs/timeline.ts","lineNumber":63,"sourceCode":"    const page_size = ctx.req.query('limit') || '20';\n    const searchParams = {\n        gids: 2,\n        page_size,\n    };\n    const link = 'https://www.miyoushe.com/ys/timeline';\n    const url = 'https://bbs-api.miyoushe.com/painter/wapi/timeline/list';\n    const response = await got({\n        method: 'get',\n        url,\n        searchParams,\n        headers: {\n            Referer: link,\n            Cookie: config.mihoyo.cookie,\n        },\n    });\n    const list = response?.data?.data?.list;\n    if (!list) {\n        throw new Error('未获取到数据！');\n    }\n    const { nickname: username } = await cache.getUserFullInfo(ctx, '');\n    const title = `米游社 - ${username} 的关注动态`;\n    const items = list.map((e) => post2item(e));\n\n    const data = {\n        title,\n        link,\n        item: items,\n    };\n    return data;\n}\n","sourceCodeStart":45,"sourceCodeEnd":76,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/mihoyo/bbs/timeline.ts#L45-L76","documentation":"Thrown by the Miyoushe (米游社) 'followed timeline' route when the upstream API call to bbs-api.miyoushe.com/painter/wapi/timeline/list returns a response whose .data.data.list is falsy. It is a bare `throw new Error('未获取到数据！')` (Chinese for 'No data obtained'), not a typed RSSHub error, so it surfaces as a generic 500 rather than a structured error. The list is the array of posts from accounts the configured login follows; an empty/missing list is treated as a hard failure.","triggerScenarios":"The handler sends a GET with the operator's MIHOYO_COOKIE and a Referer of miyoushe.com/ys/timeline. The error fires when: (a) the cookie is expired/invalid so the API replies with an error envelope lacking .data.list; (b) the logged-in account follows zero users (list genuinely empty/null); (c) miyoushe returns an anti-crawler/verification (geetest) challenge page instead of JSON; (d) the response shape changed and the nested path response.data.data.list no longer exists.","commonSituations":"Self-hosters who set MIHOYO_COOKIE once and never refresh it (cookies expire within days/weeks); a fresh deploy where the cookie env var was set but the account has no followed users; miyoushe tightening its risk-control so the same cookie that worked yesterday now triggers a captcha; the API contract shifting so the data nesting moves.","solutions":["Re-log into miyoushe.com in a browser, copy a fresh cookie string, and update the MIHOYO_COOKIE environment variable, then restart RSSHub.","Confirm the configured account actually follows at least one user on miyoushe.com/ys/timeline (an account with no follows yields no list).","Reproduce the exact request (curl with the same Cookie + Referer: https://www.miyoushe.com/ys/timeline and searchParams gids=2&page_size=20) and inspect the raw JSON to see whether the API returns an error code, a captcha, or an empty list.","If the cookie is valid but risk-control blocks it, run RSSHub from a residential/IP in a region miyoushe tolerates, or supply additional cookie fields captured from a full browser session."],"exampleFix":"// before\nconst list = response?.data?.data?.list;\nif (!list) {\n    throw new Error('未获取到数据！');\n}\n\n// after — surface the real upstream reason instead of a bare error\nconst list = response?.data?.data?.list;\nif (!list) {\n    const msg = response?.data?.message || response?.data?.data?.message || 'miyoushe returned no timeline list (check MIHOYO_COOKIE / risk-control / follows)';\n    throw new Error(msg);\n}","handlingStrategy":"validation","validationCode":"// Before calling the timeline API, assert the cookie is configured and well-formed.\nconst cookie = config.mihoyo.cookie;\nif (!cookie || !cookie.includes('=')) {\n    throw new ConfigNotFoundError('MIHOYO_COOKIE is missing or malformed — re-log into miyoushe.com and set it.');\n}","typeGuard":"// Narrow the upstream envelope before accessing .list\nfunction isTimelineEnvelope(r: unknown): r is { data: { data: { list: unknown[] } } } {\n    return !!r && typeof r === 'object'\n        && Array.isArray((r as any)?.data?.data?.list);\n}","tryCatchPattern":null,"preventionTips":["Document cookie expiry expectations for operators and add a health-check endpoint that calls the timeline API at startup.","Treat a missing list as a typed error (e.g. NotFoundError) with the upstream message instead of a bare Error, so monitoring can distinguish auth-failure from empty.","Cache the cookie-validity signal and alert when the API starts returning auth-error envelopes."],"tags":["api-data-empty","authentication","cookie","anti-crawler","mihoyo"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}