jackwener/OpenCLI · warning · TimeoutError

twitter like confirmation

Error message

twitter like confirmation

What it means

This TimeoutError is thrown when the like write was started inside the page (writeStarted=true) but the confirmation result never came back — the in-page evaluate threw after beginning the action. Because the like may actually have been applied, the error message tells the user to check the tweet before retrying to avoid double-liking or a confusing state.

Source

Thrown at clis/twitter/like.js:74

            // Click Like
            writeStarted = true;
            likeBtn.click();
            await new Promise(r => setTimeout(r, 1000));

            // Verify success by checking if the 'unlike' button reappeared
            const verifyArticle = findTargetArticle() || targetArticle;
            const verifyBtn = verifyArticle?.querySelector('[data-testid="unlike"]');
            if (verifyBtn) {
                return { ok: true, message: 'Tweet successfully liked.' };
            } else {
                return { ok: false, unconfirmed: true, message: 'Like action was initiated but UI did not update as expected.' };
            }
        } catch (e) {
            return { ok: false, unconfirmed: writeStarted, message: e.toString() };
        }
    })()`);
        if (result.unconfirmed) {
            throw new TimeoutError('twitter like confirmation', 1, `${result.message} Check the tweet before retrying; the like may already have succeeded.`);
        }
        if (!result.ok) {
            throw new CommandExecutionError(result.message, 'Nothing changed. Open the tweet in the browser and retry.');
        }
        await page.wait(2);
        return [{
                status: 'success',
                message: result.message
            }];
    }
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open the tweet in the browser and check whether the like was actually applied before doing anything
  2. If the tweet is already liked, do not retry — the action succeeded
  3. If not liked, simply re-run `twitter like`
  4. Retry when the network/page is more stable; increase wait budgets if the library allows
  5. Update the library if Twitter's DOM changed
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await clis.twitter.like.func(page, { url });
} catch (e) {
  if (e instanceof TimeoutError || /confirmation/.test(e.message)) {
    // side effect may have applied: check the tweet's liked state before retrying
    const liked = await checkTweetLiked(page, url);
    if (!liked) await clis.twitter.like.func(page, { url });
  } else throw e;
}

Prevention

When it happens

Trigger: During `twitter like`, the page.evaluate IIFE set writeStarted=true (clicked the like control) but then threw (catch branch returns {ok:false, unconfirmed:true, message}), so result.unconfirmed is truthy at like.js:74.

Common situations: Twitter UI re-rendered or navigated mid-click, causing the confirmation selector lookup to time out or throw; slow network so the liked state never rendered; an element detached right after the click; Twitter returned an unexpected toast/overlay that broke the confirmation logic.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/4768afb7c10c03a6. Report an issue: GitHub.