jackwener/OpenCLI · warning · TimeoutError

twitter unfollow confirmation

Error message

twitter unfollow confirmation

What it means

TimeoutError (code TIMEOUT) labeled 'twitter unfollow confirmation' with a 1-second window. The in-page script clicked the unfollow control (writeStarted=true) but the confirmation (unfollow dialog completion / follow-state change) was not observed, so the library throws with the page error text and warns the unfollow may already have succeeded. Users are told to check the profile before retrying since re-clicking could toggle the follow back on.

Source

Thrown at clis/twitter/unfollow.js:70

                return { ok: false, message: 'Unfollow confirmation dialog did not appear.' };
            }
            writeStarted = true;
            confirmBtn.click();
            await new Promise(r => setTimeout(r, 1000));

            // Verify
            const verify = document.querySelector('[data-testid$="-follow"]');
            if (verify) {
                return { ok: true, message: 'Successfully unfollowed @${username}.' };
            } else {
                return { ok: false, unconfirmed: true, message: 'Unfollow action initiated but UI did not update.' };
            }
        } catch (e) {
            return { ok: false, unconfirmed: writeStarted, message: e.toString() };
        }
    })()`);
        if (result.unconfirmed) {
            throw new TimeoutError('twitter unfollow confirmation', 1, `${result.message} Check the profile before retrying; the unfollow may already have succeeded.`);
        }
        if (!result.ok) {
            throw new CommandExecutionError(result.message, 'Nothing changed. Open the profile in the browser and retry.');
        }
        await page.wait(2);
        return [{
                status: 'success',
                message: result.message
            }];
    }
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open https://x.com/<username> and visually verify whether the unfollow already happened before retrying (retrying blindly may re-follow)
  2. Retry on a stable connection with the profile fully loaded
  3. If it consistently fails, suspect an X UI/markup change — update or report the library

Example fix

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

Strategy: try-catch

Validate before calling

// preflight: load the profile and verify you follow the account
await page.goto(`https://x.com/${username}`);
await page.waitForSelector('[data-testid="primaryColumn"]', { timeout: 10000 });
// if no '[data-testid="follow"]'-style Following control exists, you do not follow them

Type guard

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

Try / catch

try {
  await cli.run(['twitter', 'unfollow', user]);
} catch (e) {
  if (e.code === 'TIMEOUT' && /unfollow confirmation/.test(e.message)) {
    // do NOT auto-retry — blind retry may re-follow the account
    console.warn('Unconfirmed — check the profile before retrying');
  } else throw e;
}

Prevention

When it happens

Trigger: During `twitter unfollow`, the evaluate()'d script clicked the follow/unfollow toggle (writeStarted=true) but the confirmation state was not detected within the window — typically an in-page exception after the click or slow UI update.

Common situations: Unfollow confirmation dialog (X sometimes asks 'Unfollow?') not resolved in time; slow rendering/network; X markup change for the confirmation state; overlay intercepting the confirm button.

Related errors


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