{"record":{"id":"c42fd1b3b5373a86","repo":"DIYgod/RSSHub","slug":"error-c42fd1","errorCode":null,"errorMessage":"这个人没有任何动态。","messagePattern":"这个人没有任何动态。","errorType":"exception","errorClass":"InvalidParameterError","httpStatus":null,"severity":"warning","filePath":"lib/routes/coolapk/user-dynamic.ts","lineNumber":40,"sourceCode":"        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: '用户',\n    maintainers: ['xizeyoupan'],\n    handler,\n};\n\nasync function handler(ctx) {\n    const uid = ctx.req.param('uid');\n    const full_url = utils.base_url + `/v6/user/feedList?uid=${uid}&page=1&showAnonymous=0&isIncludeTop=1&showDoing=1`;\n    let username;\n    const response = await got(full_url, {\n        headers: utils.getHeaders(),\n    });\n    const data = response.data.data;\n    if (!data) {\n        throw new InvalidParameterError('这个人没有任何动态。');\n    }\n    let out = await Promise.all(\n        data.map((item) => {\n            if (!username) {\n                username = item.username;\n            }\n\n            return utils.parseDynamic(item);\n        })\n    );\n\n    out = out.filter(Boolean); // 去除空值\n    if (out.length === 0) {\n        throw new InvalidParameterError('这个人还没有图文或动态。');\n    }\n    return {\n        title: `酷安个人动态-${username}`,\n        link: `https://www.coolapk.com/u/${uid}`,","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/coolapk/user-dynamic.ts#L22-L58","documentation":"The coolapk user-dynamic route calls /v6/user/feedList and checks response.data.data. If data is falsy (null or undefined), the API did not return a feed list. This typically means the user account does not exist, has been deleted, or the API returned an error object where the data field is absent.","triggerScenarios":"got() succeeds (HTTP 200) but response.data.data is null or undefined. The coolapk API wraps results in a top-level { data: { data: [...] } } structure — if the inner data is null, the user has no accessible feed.","commonSituations":"The uid does not correspond to a valid coolapk user; the user account was banned or deleted; coolapk's API returns an error response (e.g., { status: 0, error: -1 }) where .data.data is null; rate limiting causes the API to return a truncated response.","solutions":["Verify the uid is valid by visiting https://www.coolapk.com/u/<uid> in a browser.","Log response.data to inspect the full API response and check for an error field.","Check if the coolapk API requires additional authentication or headers for user feeds.","Consider adding a distinct error for 'user not found' vs 'user has no dynamics'."],"exampleFix":"// before\nconst data = response.data.data;\nif (!data) {\n    throw new InvalidParameterError('这个人没有任何动态。');\n}\n\n// after — distinguish not-found from empty\nconst data = response.data.data;\nif (!data) {\n    if (response.data.errorCode || response.data.error) {\n        throw new InvalidParameterError(`User ${uid} not found or inaccessible`);\n    }\n    throw new InvalidParameterError('这个人没有任何动态。');\n}","handlingStrategy":"validation","validationCode":"// Check the full API response structure\nconst data = response.data?.data;\nif (!data) {\n    if (response.data?.errorMessage) {\n        throw new InvalidParameterError(`Coolapk API error: ${response.data.errorMessage}`);\n    }\n    throw new InvalidParameterError(`User ${uid} not found or has no dynamics`);\n}","typeGuard":"function hasUserData(response: any): response is { data: { data: any[] } } {\n    return response?.data?.data != null && Array.isArray(response.data.data);\n}","tryCatchPattern":null,"preventionTips":["Validate the uid format before making the API call.","Check response.data for error fields before accessing data.data.","Log the full API response when data is null to distinguish 'user not found' from 'API error'."],"tags":["coolapk","validation","user-profile","api-error"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}