jackwener/OpenCLI · error · CommandExecutionError
Instagram did not keep the ${shouldLike ? 'like' : 'unlike'}
Error message
Instagram did not keep the ${shouldLike ? 'like' : 'unlike'} on ${post.code} What it means
Thrown when an Instagram like/unlike action appears to succeed in the browser but a verification re-read of the like state finds it did not persist. Instagram silently rejected the action (e.g. rate limiting, bot detection, or the post already being in the target state). The CLI retries then gives up with this error.
Source
Thrown at clis/instagram/_shared/post-like.js:219
);
}
if (click.already) {
await confirmPersistedState(page, username, index, command, post, shouldLike);
return settled;
}
for (let attempt = 0; attempt < 5; attempt += 1) {
await page.sleep(1);
if (unwrapEvaluateResult(await page.evaluate(buildReadLikeStateJs(shouldLike))) !== true) continue;
// A rejected action reverts the icon shortly after the optimistic flip.
await page.sleep(2);
if (unwrapEvaluateResult(await page.evaluate(buildReadLikeStateJs(shouldLike))) === true) {
await confirmPersistedState(page, username, index, command, post, shouldLike);
return [{ status: shouldLike ? 'Liked' : 'Unliked', user: username, post: label }];
}
break;
}
throw new CommandExecutionError(
`Instagram did not keep the ${shouldLike ? 'like' : 'unlike'} on ${post.code}`,
'The action may have been rejected. Retry later, or check the post in the browser.',
);
}
View on GitHub (pinned to 49907e53dc)
Solutions
- Retry later — Instagram action blocks are usually temporary
- Open the post in a browser to confirm it is still likeable and the account is healthy
- Slow down: reduce batch size / add delays between like operations
- Re-login to refresh the session if the account is flagged
Example fix
// before
await cli.run(['instagram', 'post', 'like', '--code', post.code]);
// after
try {
await cli.run(['instagram', 'post', 'like', '--code', post.code]);
} catch (e) {
if (e instanceof CommandExecutionError) await sleep(60_000); // back off, retry later
else throw e;
} Defensive patterns
Strategy: retry
Validate before calling
// verify post is reachable and account healthy before the batch
const state = await page.evaluate(buildReadLikeStateJs(true));
if (state === 'rate_limited') throw new Error('back off'); Try / catch
try {
await setInstagramPostLike(opts);
} catch (e) {
if (e instanceof CommandExecutionError && /did not keep the/.test(e.message)) {
await sleep(backoffMs); // exponential backoff, retry later
} else throw e;
} Prevention
- Rate-limit like/unlike operations with delays between them
- Check the like state before acting to avoid redundant toggles
- Watch for action-block signals and pause the batch early
When it happens
Trigger: Calling the instagram post like/unlike command when Instagram rejects the action: the button state re-read via buildReadLikeStateJs does not match shouldLike after retry attempts.
Common situations: Liking too many posts in a short window (action block), session flagged for automation, post deleted or restricted, stale page after navigation.
Related errors
- HTTP ${result.httpStatus} from Instagram /users/info
- Chess.com API returned HTTP ${resp.status} for ${url}
- coingecko derivatives returned HTTP 429 (rate limited)
- coingecko returned HTTP 429 (rate limited)
- ${label} returned HTTP 429 (rate limited)
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/2b2a06390d3831da.
Report an issue: GitHub.