{"record":{"id":"d5362b90ad1dcb7a","repo":"jackwener/OpenCLI","slug":"weibo-user-posts-failed-without-an-error-message","errorCode":null,"errorMessage":"weibo user-posts failed without an error message","messagePattern":"weibo user-posts failed without an error message","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/weibo/user-posts.js","lineNumber":65,"sourceCode":"    }).formatToParts(date);\n    const get = (type) => parts.find((part) => part.type === type)?.value;\n    return `${get('year')}-${get('month')}-${get('day')}`;\n}\n\nfunction dateToTimestamp(date) {\n    return Math.floor(new Date(`${date}T00:00:00+08:00`).getTime() / 1000);\n}\n\nfunction validateRange(start, end) {\n    if (start && end && dateToTimestamp(start) > dateToTimestamp(end)) {\n        throw new ArgumentError('weibo user-posts start must be <= end');\n    }\n}\n\nfunction mapError(error) {\n    const message = String(error ?? '').trim();\n    if (!message) {\n        throw new CommandExecutionError('weibo user-posts failed without an error message');\n    }\n    if (/login|cookie|登录|auth|forbidden|permission|权限|unauthorized/i.test(message)) {\n        throw new AuthRequiredError('weibo.com', message);\n    }\n    throw new CommandExecutionError(message);\n}\n\nexport const testInternals = {\n    readRequiredId,\n    readLimit,\n    readDate,\n    dateToTimestamp,\n};\n\ncli({\n    site: 'weibo',\n    name: 'user-posts',\n    access: 'read',","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weibo/user-posts.js#L47-L83","documentation":"mapError() converts underlying extraction/browser errors into typed CLI errors. When the error value is null/undefined or stringifies to an empty/whitespace-only string, the library has no message to report, so it throws this CommandExecutionError. It exists so failures are never silently swallowed with an uninformative cause.","triggerScenarios":"The in-page extraction returns {error: null} or {error: ''}, or an exception object with no message reaches mapError from the payload.error branch.","commonSituations":"Page scripts failing before producing a message (navigation aborted, evaluate returned an undefined error), or upstream code replacing a real error with undefined.","solutions":["Re-run the command to see if the transient empty error recurs.","Run with verbose/debug logging to capture the underlying browser/network state at failure time.","Check network connectivity and whether weibo.com is reachable from your environment."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await runUserPosts({ id, start, end });\n} catch (err) {\n  if (err instanceof CommandExecutionError && /failed without an error message/.test(err.message)) {\n    // retry once or enable verbose logging to diagnose\n  } else throw err;\n}","preventionTips":["Ensure stable network before long extraction runs.","Enable verbose/debug output so underlying failures are captured with messages.","Retry transient failures once before investigating."],"tags":["command-execution","unknown-error","diagnostics"],"backgroundTag":"empty-error-message","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}