{"record":{"id":"353bc3f4c0d5f666","repo":"jackwener/OpenCLI","slug":"string-data-error-353bc3","errorCode":null,"errorMessage":"String(data.error)","messagePattern":"String\\(data\\.error\\)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/weibo/post.js","lineNumber":69,"sourceCode":"          source: strip(s.source || ''),\n          reposts: s.reposts_count || 0,\n          comments: s.comments_count || 0,\n          likes: s.attitudes_count || 0,\n          pic_count: s.pic_num || 0,\n          url: 'https://weibo.com/' + (u.id || '') + '/' + (s.mblogid || ''),\n        };\n\n        if (s.retweeted_status) {\n          const rt = s.retweeted_status;\n          result.retweeted_from = (rt.user?.screen_name || '[deleted]');\n          result.retweeted_text = rt.text_raw || strip(rt.text || '');\n        }\n\n        return result;\n      })()\n    `)), 'weibo post');\n        if (data.error)\n            throw new CommandExecutionError(String(data.error));\n        return Object.entries(data).map(([field, value]) => ({\n            field,\n            value: String(value),\n        }));\n    },\n});\n","sourceCodeStart":51,"sourceCodeEnd":76,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weibo/post.js#L51-L76","documentation":"The weibo post command's in-page script returned an object containing an `error` field, which the CLI converts to a string and rethrows as a CommandExecutionError. This means the page-side evaluation (scraping/posting step) reported a failure rather than returning data; the library surfaces the page's own error message verbatim so you can see what went wrong inside the browser context.","triggerScenarios":"Running the `weibo post` command when the page.evaluate script sets data.error — e.g. the target element was not found, the page structure changed, or the in-page action failed while data still returned.","commonSituations":"Weibo DOM changes breaking the injected script selectors; running while logged out so the expected data never renders; network hiccups causing partial page loads.","solutions":["Read the wrapped message (String(data.error)) to see the underlying page-side failure","Ensure you are logged into weibo.com in the controlled Chrome session and the page loaded fully","Update the library in case Weibo changed its DOM and selectors were fixed upstream","Re-run the command; transient page-load issues often resolve on retry"],"exampleFix":"// before: raw thrown error\nthrow new CommandExecutionError(String(data.error));\n// after: guard before running by checking login/page state first\nawait getSelfUid(page); // throws AuthRequiredError early if not logged in","handlingStrategy":"try-catch","validationCode":"if (typeof data === 'object' && data !== null && 'error' in data) {\n  console.warn('page reported error:', String(data.error));\n}","typeGuard":"function hasPageError(d) {\n  return typeof d === 'object' && d !== null && 'error' in d && d.error != null;\n}","tryCatchPattern":"try {\n  await cli.run(['weibo', 'post']);\n} catch (err) {\n  if (err instanceof CommandExecutionError) {\n    console.error('weibo post failed:', err.message);\n    // re-check login/session before retrying\n  } else throw err;\n}","preventionTips":["Verify login with getSelfUid before running post","Keep the extension/CLI updated for DOM changes","Retry once on transient page-load failures"],"tags":["browser-automation","weibo","page-evaluate"],"backgroundTag":"page-evaluate-runtime-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}