{"record":{"id":"71d2eace2dd3a1d9","repo":"jackwener/OpenCLI","slug":"weibo-delete","errorCode":null,"errorMessage":"weibo delete","messagePattern":"weibo delete","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/weibo/delete.js","lineNumber":155,"sourceCode":"          return { ok: false, error: 'verify_malformed', msg: 'verify returned non-JSON response', id: idstr };\n        }\n        if (!verifyBody || typeof verifyBody !== 'object') {\n          return { ok: false, error: 'verify_malformed', msg: 'verify returned malformed response', id: idstr };\n        }\n        if (String(verifyBody.idstr || '') === idstr) {\n          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":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weibo/delete.js#L137-L173","documentation":"clis/weibo/delete.js:155 throws EmptyResultError('weibo delete', ...) when the delete script reports error==='not_found': the post id was syntactically valid but Weibo returned no matching mblog for the logged-in account. The library uses this to distinguish 'nothing to delete' from transient HTTP or auth failures.","triggerScenarios":"Calling `weibo delete <id|url>` where the id/mblogid does not resolve to an existing post: post already deleted, post belongs to another account, malformed-but-passing id, or a weibo.cn-style URL whose extracted id is wrong.","commonSituations":"Deleting the same post twice (second call hits not_found); id copied from a repost instead of the original; typo in mblogid; post removed by Weibo moderation or by the author from another device.","solutions":["Confirm the post still exists by opening its URL in Chrome while logged in","Ensure the post belongs to the currently logged-in account — you can only delete your own posts","Re-copy the id or post URL; for weibo.cn URLs verify the /status/<id> segment is the mblogid","Treat a repeat not_found as 'already deleted' and skip rather than retry"],"exampleFix":"// before\nawait cli.run('weibo delete', { id: alreadyDeletedId });\n// after: guard against already-deleted\ntry {\n  await cli.run('weibo delete', { id });\n} catch (e) {\n  if (e instanceof EmptyResultError) return { status: 'already-deleted', id };\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"function isValidPostId(id) { const s = String(id ?? '').trim(); return /^[A-Za-z0-9]{4,32}$/.test(s) || /^https?:\\/\\/(www\\.)?weibo\\.(com|cn)\\//.test(s); }\nif (!isValidPostId(id)) throw new Error('bad weibo post id/url: ' + id);","typeGuard":"function isEmptyResultError(e) { return e instanceof Error && e.name === 'EmptyResultError'; }","tryCatchPattern":"try {\n  await cli.run('weibo delete', { id });\n} catch (e) {\n  if (isEmptyResultError(e)) return { status: 'not-found-or-deleted', id };\n  throw e;\n}","preventionTips":["Track which ids you already deleted and skip them on retry","Only delete posts from the account currently logged into Chrome","Use the post URL rather than a hand-copied id when possible","Verify existence once before batch deletes"],"tags":["weibo","not-found","empty-result","delete"],"backgroundTag":"resource-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}