{"record":{"id":"dc98193fd6138da0","repo":"jackwener/OpenCLI","slug":"string-data-error","errorCode":null,"errorMessage":"String(data.error)","messagePattern":"String\\(data\\.error\\)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/weibo/me.js","lineNumber":72,"sourceCode":"        if (!info.ok) return {error: 'API error'};\n        const p = info.data?.user;\n        if (!p) return {error: 'User data not found'};\n        return {\n          screen_name: p.screen_name,\n          uid: p.id,\n          followers: p.followers_count,\n          following: p.friends_count,\n          statuses: p.statuses_count,\n          verified: p.verified || false,\n          location: p.location || '',\n          description: p.description || d.description || '',\n          avatar: p.avatar_hd || p.avatar_large || '',\n          profile_url: 'https://weibo.com' + (p.profile_url || '/u/' + p.id),\n        };\n      })()\n    `)), 'weibo me');\n        if (data.error)\n            throw new CommandExecutionError(String(data.error));\n        return data;\n    },\n});\n","sourceCodeStart":54,"sourceCodeEnd":76,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weibo/me.js#L54-L76","documentation":"clis/weibo/me.js:72 throws CommandExecutionError(String(data.error)) when the profile-fetch script returns a payload containing an error field — i.e. Weibo's API itself reported an error for the logged-in user's profile request. The message is Weibo's own error text (often Chinese), passed through verbatim.","triggerScenarios":"Running `weibo me` when the in-page request for the logged-in user's profile returns { error: ... } — typically an expired/invalid session (Weibo returns error text instead of a profile object) or an API-level rejection.","commonSituations":"Expired weibo.com cookies so the profile endpoint returns an error object; account restrictions or risk-control challenges; Weibo API changes renaming/moving fields so the script reads an error payload.","solutions":["Read the included message — it is Weibo's own error text explaining the cause","If it indicates login/session problems, re-login to weibo.com in the current Chrome browser","Reload weibo.com and confirm the profile page loads; complete any security verification Weibo shows","If the message references missing fields or unknown API errors, update the CLI to match current Weibo responses"],"exampleFix":"// before\nconst me = await cli.run('weibo me', {});\n// after\ntry {\n  const me = await cli.run('weibo me', {});\n} catch (e) {\n  if (e instanceof CommandExecutionError) console.error('weibo me failed:', e.message, '— try re-logging into weibo.com in Chrome');\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isUpstreamWeiboError(e) { return e instanceof Error && e.name === 'CommandExecutionError' && !/^weibo me: HTTP/.test(e.message); }","tryCatchPattern":"try {\n  const me = await cli.run('weibo me', {});\n} catch (e) {\n  if (isUpstreamWeiboError(e)) {\n    console.error('Weibo returned:', e.message); // often login-related Chinese text\n    // prompt user to re-login weibo.com in Chrome\n  }\n  throw e;\n}","preventionTips":["Log the passthrough message — it contains Weibo's own diagnosis","Check `weibo me` early in scripts as a session health probe before other calls","Re-login in Chrome whenever the message mentions login/session","Treat recurring unknown error text as a signal to update the CLI"],"tags":["weibo","api","auth","command-execution"],"backgroundTag":"upstream-api-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}