{"record":{"id":"0b2788083233be30","repo":"jackwener/OpenCLI","slug":"twitter-retweet-confirmation","errorCode":null,"errorMessage":"twitter retweet confirmation","messagePattern":"twitter retweet confirmation","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"clis/twitter/retweet.js","lineNumber":88,"sourceCode":"            }\n            writeStarted = true;\n            confirmBtn.click();\n            await new Promise(r => setTimeout(r, 1000));\n\n            // Verify success by checking if the 'unretweet' button appeared\n            const verifyArticle = findTargetArticle() || targetArticle;\n            const verifyBtn = verifyArticle?.querySelector('[data-testid=\"unretweet\"]');\n            if (verifyBtn) {\n                return { ok: true, message: 'Tweet successfully retweeted.' };\n            } else {\n                return { ok: false, unconfirmed: true, message: 'Retweet action was initiated but UI did not update as expected.' };\n            }\n        } catch (e) {\n            return { ok: false, unconfirmed: writeStarted, message: e.toString() };\n        }\n    })()`);\n        if (result.unconfirmed) {\n            throw new TimeoutError('twitter retweet confirmation', 1, `${result.message} Check the tweet before retrying; the retweet may already have succeeded.`);\n        }\n        if (!result.ok) {\n            throw new CommandExecutionError(result.message, 'Nothing changed. Open the tweet in the browser and retry.');\n        }\n        await page.wait(2);\n        return [{\n                status: 'success',\n                message: result.message\n            }];\n    }\n});\n","sourceCodeStart":70,"sourceCodeEnd":100,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/twitter/retweet.js#L70-L100","documentation":"TimeoutError thrown after the retweet click script could not confirm the retweet within 1 attempt/timeout window. The library intentionally does not retry because the click may have actually succeeded, making a blind retry risky (double retweet or un-retweet). It surfaces the underlying script failure message plus guidance to verify the tweet manually.","triggerScenarios":"Calling `opencli twitter retweet <url>` when the in-page script that clicks the retweet button and awaits confirmation times out or throws — e.g. slow page load, retweet button selector missing, UI layout change, or network stall during the confirmation window.","commonSituations":"Slow/unstable connection to x.com, X's UI serving a different retweet dialog (e.g. logged-out state or A/B test), page not fully settled before clicking, or the tweet already retweeted so no confirmation appears.","solutions":["Open the tweet in the browser and check whether the retweet already succeeded before doing anything else","Retry the retweet command once the page loads normally; if already retweeted, undo or skip","Re-run after `opencli` login/cookie refresh if the page appeared logged out","Update opencli if X changed its DOM and the selector consistently fails"],"exampleFix":"// before\nawait opencli.twitter.retweet(url); // TimeoutError: retweet confirmation\n// after\nconst status = await checkTweetRetweeted(url); // verify manually/via API first\nif (!status.retweeted) await opencli.twitter.retweet(url);","handlingStrategy":"try-catch","validationCode":"// Ensure the page is loaded and logged in before retweeting\nconst cookies = await page.getCookies({ url: 'https://x.com' });\nif (!cookies.some((c) => c.name === 'ct0')) throw new Error('Not logged into x.com');","typeGuard":"function isTimeoutError(e) { return e && e.name === 'TimeoutError'; }","tryCatchPattern":"try {\n  await opencli.twitter.retweet(url);\n} catch (e) {\n  if (isTimeoutError(e)) {\n    // DO NOT blind-retry: check the tweet state first, then decide\n    const done = await verifyRetweetedInBrowser(url);\n    if (!done) await opencli.twitter.retweet(url);\n  } else throw e;\n}","preventionTips":["Wait for full page load/settle before invoking retweet commands","Keep the x.com session (ct0 cookie) fresh","Verify tweet state before retrying after a timeout","Keep opencli updated for X DOM/selector changes"],"tags":["timeout","twitter","retweet","confirmation"],"backgroundTag":"operation-confirm-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}