jackwener/OpenCLI · warning · TimeoutError

twitter unbookmark confirmation

Error message

twitter unbookmark confirmation

What it means

TimeoutError (code TIMEOUT) labeled 'twitter unbookmark confirmation' with a 1-second confirmation window. The in-page script clicked the bookmark-remove control (writeStarted=true) but success was not confirmed before the script returned, so the library throws with the page error text and warns that the removal may already have succeeded. Users must check the tweet before retrying to avoid double effects.

Source

Thrown at clis/twitter/unbookmark.js:67

            writeStarted = true;
            removeBtn.click();
            await new Promise(r => setTimeout(r, 1000));

            // Verify
            const verifyArticle = findTargetArticle() || targetArticle;
            const verify = verifyArticle?.querySelector('[data-testid="bookmark"]');
            if (verify) {
                return { ok: true, message: 'Tweet successfully removed from bookmarks.' };
            } else {
                return { ok: false, unconfirmed: true, message: 'Unbookmark action initiated but UI did not update.' };
            }
        } catch (e) {
            return { ok: false, unconfirmed: writeStarted, message: e.toString() };
        }
    })()`);
        if (result.unconfirmed) {
            throw new TimeoutError('twitter unbookmark confirmation', 1, `${result.message} Check the tweet before retrying; the removal 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 verify whether the bookmark was actually removed before retrying (the hint explicitly warns it may already have succeeded)
  2. Retry once the page has fully loaded on a stable connection
  3. If it consistently times out, suspect an X UI change — update or report the library

Example fix

// before
await cli.run(['twitter', 'unbookmark', tweetUrl]);
// after
try {
  await cli.run(['twitter', 'unbookmark', tweetUrl]);
} catch (e) {
  if (e.code === 'TIMEOUT') console.warn('Unconfirmed — check the tweet manually before retrying');
}
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: ensure the tweet page loads and you are logged in
await page.goto(target.url);
await page.waitForSelector('[data-testid="primaryColumn"]', { timeout: 10000 });

Type guard

function isTimeoutError(e) { return e && e.code === 'TIMEOUT'; }

Try / catch

try {
  await cli.run(['twitter', 'unbookmark', tweetUrl]);
} catch (e) {
  if (e.code === 'TIMEOUT' && /unbookmark confirmation/.test(e.message)) {
    // do not auto-retry — check the tweet; removal may have succeeded
    console.warn('Unconfirmed — check the tweet before retrying');
  } else throw e;
}

Prevention

When it happens

Trigger: During `twitter unbookmark`, the evaluate()'d script clicked the bookmark toggle (writeStarted=true) but the confirmation state (bookmark icon/UI update) was not observed, usually because an exception fired after the click or the page was slow to reflect the change.

Common situations: Slow X rendering/network after the click; confirmation selector mismatch due to X markup changes; an in-page exception (navigation, detached node) after the click; toast/overlay covering the confirmation element.

Related errors


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