{"record":{"id":"265433866423eec6","repo":"jackwener/OpenCLI","slug":"string-data-error-265433","errorCode":null,"errorMessage":"String(data.error)","messagePattern":"String\\(data\\.error\\)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/weibo/user.js","lineNumber":60,"sourceCode":"          uid: u.id,\n          followers: u.followers_count,\n          following: u.friends_count,\n          statuses: u.statuses_count,\n          verified: u.verified || false,\n          verified_reason: u.verified_reason || '',\n          description: u.description || d.description || '',\n          location: u.location || '',\n          gender: u.gender === 'm' ? 'male' : u.gender === 'f' ? 'female' : '',\n          avatar: u.avatar_hd || u.avatar_large || '',\n          url: 'https://weibo.com' + (u.profile_url || '/u/' + u.id),\n          birthday: d.birthday || '',\n          created_at: d.created_at || '',\n          ip_location: d.ip_location || '',\n        };\n      })()\n    `)), 'weibo user');\n        if (data.error)\n            throw new CommandExecutionError(String(data.error));\n        return data;\n    },\n});\n","sourceCodeStart":42,"sourceCodeEnd":64,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weibo/user.js#L42-L64","documentation":"This error is thrown when a Weibo in-page evaluate returns an object containing an `error` field. The library wraps the raw error value with String() and rethrows it as a CommandExecutionError so CLI callers get a readable message instead of silently returning bad data.","triggerScenarios":"A page.evaluate() extraction in clis/weibo/user.js succeeds in returning an object, but that object carries an `error` property (e.g. the injected extraction script caught an in-page failure and returned {error: ...} instead of the user payload).","commonSituations":"Weibo DOM changes break the extraction script; the profile page returned an error/verify page; login expired so the injected script found no user data and reported an error.","solutions":["Re-run the command after re-authenticating the Weibo session (cookie/login may have expired).","Update the weibo CLI to a version matching the current weibo.com DOM/API.","Inspect the actual error text in the message — it is the raw in-page error surfaced verbatim.","If developing the CLI, make the injected script throw instead of returning {error} so stack traces are preserved."],"exampleFix":"// before\nif (data.error) throw new CommandExecutionError(String(data.error));\n// after\nif (data?.error) throw new CommandExecutionError(`weibo user: ${String(data.error)}`);","handlingStrategy":"try-catch","validationCode":"const data = unwrapEvaluateResult(await page.evaluate(script));\nif (data && typeof data === 'object' && 'error' in data) {\n  throw new Error(`weibo user in-page error: ${data.error}`);\n}","typeGuard":"function hasPayloadError(d) {\n  return d !== null && typeof d === 'object' && 'error' in d;\n}","tryCatchPattern":"try {\n  const user = await weiboUserCommand.run(uid);\n} catch (err) {\n  if (err instanceof CommandExecutionError) {\n    console.error('Weibo extraction failed:', err.message);\n    // re-authenticate or fall back\n  } else throw err;\n}","preventionTips":["Re-authenticate weibo.com sessions before long scraping runs","Keep the CLI updated for Weibo DOM changes","Log the raw evaluate payload when debugging","Fail fast: check session validity before extraction"],"tags":["weibo","scraping","command-execution","dom-extraction"],"backgroundTag":"page-evaluate-extraction-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}