{"record":{"id":"d68f3a0b47a1c793","repo":"jackwener/OpenCLI","slug":"weibo-delete-string-result-msg-result-error","errorCode":null,"errorMessage":"weibo delete: ${String(result.msg ?? result.error)}","messagePattern":"weibo delete: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/weibo/delete.js","lineNumber":161,"sourceCode":"          return { ok: false, error: 'still_exists', id: idstr, mblogid: verifyBody.mblogid || mblogid };\n        }\n        if (!verifyBody.idstr || verifyBody.ok === 0) {\n          return { ok: true, id: idstr, mblogid };\n        }\n        return { ok: false, error: 'verify_mismatch', msg: 'verify returned a different post id', id: idstr };\n      })()\n    `)), 'weibo delete');\n        if (result.error === 'auth') {\n            throw new AuthRequiredError('weibo.com', 'Cookie 已过期！请在当前 Chrome 浏览器中重新登录 Weibo。');\n        }\n        if (result.error === 'not_found') {\n            throw new EmptyResultError('weibo delete', `Post not found for id \"${String(result.input ?? raw)}\". Verify the post still exists and belongs to the logged-in account.`);\n        }\n        if (result.error === 'show_http' || result.error === 'destroy_http' || result.error === 'verify_http') {\n            throw new CommandExecutionError(`weibo delete: HTTP ${result.status}`);\n        }\n        if (result.error === 'api' || result.error === 'verify_malformed' || result.error === 'verify_mismatch' || result.error === 'still_exists') {\n            throw new CommandExecutionError(`weibo delete: ${String(result.msg ?? result.error)}`);\n        }\n        if (!result.ok) {\n            throw new CommandExecutionError('weibo delete returned an unexpected response');\n        }\n        return [{ status: 'deleted', id: String(result.id ?? ''), mblogid: String(result.mblogid ?? '') }];\n    },\n});\n\nexport const __test__ = {\n    normalizePostId,\n};\n","sourceCodeStart":143,"sourceCodeEnd":173,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weibo/delete.js#L143-L173","documentation":"clis/weibo/delete.js:161 throws CommandExecutionError(`weibo delete: ${String(result.msg ?? result.error)}`) for logical API failures: error==='api' (Weibo returned an error payload), 'verify_malformed' (verify response couldn't be parsed), 'verify_mismatch' (verify returned a different post id), or 'still_exists' (post remained after the destroy call). The message carries Weibo's own msg text when available.","triggerScenarios":"The delete script completed its HTTP calls but the outcome was wrong: Weibo's destroy API returned ok:false with a message, the verification fetch returned unparseable JSON, verification resolved a different id, or the post still exists after deletion.","commonSituations":"Weibo silently rejecting deletes via risk control; deleting a repost whose verify resolves to the original; Weibo DOM/API response format changes breaking the page-side parser; eventual consistency where the post briefly remains after delete.","solutions":["Read the included result.msg — it is Weibo's own explanation (e.g. permission denied, risk control)","Confirm you are deleting your own post and that the id is the mblogid of the post itself, not a repost target","Reload weibo.com in Chrome and check whether the post actually disappeared (still_exists may be eventual consistency)","If verify_malformed/mismatch recurs across posts, Weibo likely changed its response format — update the CLI"],"exampleFix":"// before: assuming delete succeeded\nawait cli.run('weibo delete', { id });\n// after: verify post is gone\ntry {\n  await cli.run('weibo delete', { id });\n} catch (e) {\n  if (/still_exists/.test(e.message)) console.warn('post may still exist; re-check later');\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isWeiboApiLogicError(e) { return e instanceof Error && /weibo delete: (?!HTTP)/.test(e.message) && /(verify_|still_exists|api)/.test(e.message); }","tryCatchPattern":"try {\n  await cli.run('weibo delete', { id });\n} catch (e) {\n  if (/still_exists/.test(e.message)) {\n    await new Promise(r => setTimeout(r, 5000)); // eventual consistency; optionally re-verify\n  } else if (/verify_mismatch/.test(e.message)) {\n    console.error('id resolved to a different post; use the mblogid of the post itself');\n  }\n  throw e;\n}","preventionTips":["Use the target post's own mblogid, not the repost's","After deleting, verify via the post URL before assuming failure","Keep the CLI updated for Weibo response-format changes","Surface result.msg (Weibo's text) in your logs for diagnosis"],"tags":["weibo","api","verification","command-execution"],"backgroundTag":"api-response-parse-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}