{"record":{"id":"e1ee1f05aa3a63b0","repo":"jackwener/OpenCLI","slug":"weibo-delete-returned-an-unexpected-response","errorCode":null,"errorMessage":"weibo delete returned an unexpected response","messagePattern":"weibo delete returned an unexpected response","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/weibo/delete.js","lineNumber":164,"sourceCode":"          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":146,"sourceCodeEnd":173,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weibo/delete.js#L146-L173","documentation":"clis/weibo/delete.js:164 throws CommandExecutionError('weibo delete returned an unexpected response') as the final fallback: the script's result object was neither ok nor matched any known error code. This guards against contract drift between the injected page script and the Node-side handler (requireObjectEvaluateResult/unwrapEvaluateResult).","triggerScenarios":"The evaluate() result has ok:false (or is shaped unexpectedly) without an error field the handler recognizes — e.g. the page script threw and returned a bare message, a Chrome extension interfered, or the CLI and its in-page script versions diverge.","commonSituations":"Mixing CLI versions after an update; browser extensions or anti-bot overlays breaking script execution; Chrome DevTools Protocol returning an exception object instead of the expected result shape.","solutions":["Re-run with a clean Chrome profile and extensions disabled to rule out interference","Update the CLI to the latest version so the in-page script and handler are in sync","Log the raw result (enable debug output) to see what the page script actually returned","If reproducible, file a bug with the raw result payload"],"exampleFix":"// before: opaque failure\nawait cli.run('weibo delete', { id });\n// after: capture context\ntry {\n  await cli.run('weibo delete', { id });\n} catch (e) {\n  if (/unexpected response/.test(e.message)) console.error('update the CLI / disable extensions; raw result shape unknown');\n  throw e;\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":"function isUnexpectedDeleteResponse(e) { return e instanceof Error && e.message === 'weibo delete returned an unexpected response'; }","tryCatchPattern":"try {\n  await cli.run('weibo delete', { id });\n} catch (e) {\n  if (isUnexpectedDeleteResponse(e)) {\n    console.error('Unknown delete response — update CLI, disable extensions, and re-run once.');\n    // do not retry in a loop; contract-level failure\n  }\n  throw e;\n}","preventionTips":["Keep the CLI and its in-page scripts at one version","Run with a clean profile and minimal extensions","Enable debug logging to capture the raw result when it recurs","Report reproducible cases upstream with the raw payload"],"tags":["weibo","contract-mismatch","command-execution","fallback"],"backgroundTag":"unexpected-response-shape","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}