jackwener/OpenCLI · error · CommandExecutionError
Failed to add @${username} to list ${listId}: member_count u
Error message
Failed to add @${username} to list ${listId}: member_count unchanged and membership was not confirmed What it means
A CommandExecutionError from buildListAddMemberRow thrown when the member_count did not increase (noop) and the response did not confirm isMember === true. This is the 'add silently did nothing' case: the mutation returned success-shaped data but neither the count nor an explicit membership flag proves the user was added.
Source
Thrown at clis/twitter/list-add-core.js:88
if (!hasMemberCount) {
throw new CommandExecutionError(`Failed to add @${username} to list ${listId}: no member_count in response`);
}
const memberCountAfter = Number(addResult.mc);
if (!Number.isFinite(memberCountAfter)) {
throw new CommandExecutionError(`Failed to add @${username} to list ${listId}: invalid member_count in response`);
}
if (memberCountAfter < memberCountBefore) {
throw new CommandExecutionError(
`Failed to add @${username} to list ${listId}: member_count decreased unexpectedly (${memberCountBefore} → ${memberCountAfter})`
);
}
const countIncreased = memberCountAfter > memberCountBefore;
const noop = !countIncreased;
if (noop && addResult.isMember !== true) {
throw new CommandExecutionError(
`Failed to add @${username} to list ${listId}: member_count unchanged and membership was not confirmed`
);
}
const verifiedBy = `member_count ${memberCountBefore} → ${memberCountAfter}`;
return {
listId,
username,
userId: String(userId),
status: noop ? 'noop' : 'success',
message: noop
? `@${username} is already a member of list ${listId}`
: `Added @${username} to list ${listId} (verified via ${verifiedBy})`,
};
}
export async function listAddUser(page, kwargs) {
const listId = String(kwargs.listId || '').trim();
const username = String(kwargs.username || '').replace(/^@/, '').trim();View on GitHub (pinned to 49907e53dc)
Solutions
- Check whether @username is already in the list — if so, this add was a no-op and can be skipped.
- Update the library so isMember is parsed from X's current response schema.
- Retry once with a fresh session to get a payload that confirms membership explicitly.
- If you intentionally tolerate duplicates, treat 'already a member' responses as success in your wrapper.
Example fix
// before: blind re-add of an existing member
await listAddUser(page, { listId, username: 'alice' }); // throws
// after: check membership first
const members = await listMembers(page, listId);
if (!members.includes('alice')) await listAddUser(page, { listId, username: 'alice' }); Defensive patterns
Strategy: validation
Validate before calling
// avoid the error entirely: skip users already in the list const members = new Set(await listMemberUsernames(page, listId)); const pending = usernames.filter(u => !members.has(u.replace(/^@/, '')));
Type guard
function confirmsMembership(r) {
return r?.isMember === true;
} Try / catch
try {
await listAddUser(page, { listId, username });
} catch (e) {
if (/member_count unchanged and membership was not confirmed/.test(e.message)) {
console.warn(`@${username} may already be in list ${listId}; skipping`);
return; // treat as idempotent success
}
throw e;
} Prevention
- Check list membership before adding to avoid no-op re-adds.
- Keep the library updated so isMember is parsed correctly from X's schema.
- Design list-add pipelines to be idempotent — treat 'already a member' as success.
- Retry once with a fresh session if the ambiguity is unexpected.
When it happens
Trigger: countIncreased === false and addResult.isMember !== true after the add — usually because the user was ALREADY a member (count unchanged) but the response also failed to set the isMember flag, or X returned an ambiguous payload.
Common situations: Idempotent re-run adding a user who is already in the list; X's GraphQL response omitting the isMember field due to schema drift; a soft-failed mutation that returned HTTP 200.
Related errors
- Failed to add @${username} to list ${listId}: ${msg.slice(0,
- Failed to add @${username} to list ${listId}: no member_coun
- Failed to add @${username} to list ${listId}: invalid member
- ${probe.detail}
- 12306 whoami failed: ${probe.detail}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/eb7088680b7fee5d.
Report an issue: GitHub.