{"record":{"id":"4b574f5feec2bde6","repo":"jackwener/OpenCLI","slug":"weibo-com-4b574f","errorCode":null,"errorMessage":"weibo.com","messagePattern":"weibo\\.com","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/weibo/utils.js","lineNumber":58,"sourceCode":"      const uid = store?.state?.config?.config?.uid;\n      if (uid) return String(uid);\n      return null;\n    })()\n  `));\n    if (uid)\n        return uid;\n    // Fallback: config API\n    const config = unwrapEvaluateResult(await page.evaluate(`\n    (async () => {\n      const resp = await fetch('/ajax/config/get_config', {credentials: 'include'});\n      if (!resp.ok) return null;\n      const data = await resp.json();\n      return data.ok && data.data?.uid ? String(data.data.uid) : null;\n    })()\n  `));\n    if (config)\n        return config;\n    throw new AuthRequiredError('weibo.com');\n}\n","sourceCodeStart":40,"sourceCodeEnd":60,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weibo/utils.js#L40-L60","documentation":"getSelfUid resolves the logged-in user's uid from the Vue store or a config API; if both fail it throws AuthRequiredError('weibo.com'), meaning the tool cannot determine your Weibo identity and you must log in. The message is just the domain 'weibo.com'.","triggerScenarios":"Running any weibo command that needs the account uid when neither the page's Vue store nor the config API (data.ok && data.data?.uid) yields a uid.","commonSituations":"Not logged in at all; logged into a different browser/profile than the automation; session cookies expired; Weibo API returned ok:false or omitted data.uid after a schema change.","solutions":["Log in to weibo.com in the automated browser session and retry.","Verify cookies are valid (visit weibo.com and confirm you see your profile).","Update the CLI if Weibo changed the config API response shape.","Ensure the automation targets the same profile where you logged in."],"exampleFix":"// before\nconst config = unwrapEvaluateResult(await page.evaluate(`...config api...`));\nif (config) return config;\n// after\nconst config = unwrapEvaluateResult(await page.evaluate(`...config api...`));\nif (!config) throw new AuthRequiredError('weibo.com', 'Open weibo.com and log in, then retry.');\nreturn config;","handlingStrategy":"try-catch","validationCode":"const uid = await getSelfUidSafe(page);\nif (!uid) throw new Error('Run the weibo login flow before commands needing a uid');","typeGuard":"function isAuthedConfig(d) {\n  return d !== null && typeof d === 'object' && 'ok' in d && d.ok === true && !!d.data?.uid;\n}","tryCatchPattern":"try {\n  await weiboCommand.run(args);\n} catch (err) {\n  if (err instanceof AuthRequiredError) {\n    console.error('Not logged in to weibo.com — run login, then retry');\n  } else throw err;\n}","preventionTips":["Log in to weibo.com in the automated browser profile before running","Persist cookies/session between runs","Verify session validity at workflow start","Handle Weibo config API schema changes with updates"],"tags":["weibo","auth","login-required","session-expired"],"backgroundTag":"login-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}