{"record":{"id":"2b2a06390d3831da","repo":"jackwener/OpenCLI","slug":"instagram-did-not-keep-the-shouldlike-like","errorCode":null,"errorMessage":"Instagram did not keep the ${shouldLike ? 'like' : 'unlike'} on ${post.code}","messagePattern":"Instagram did not keep the (.+?) on (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/instagram/_shared/post-like.js","lineNumber":219,"sourceCode":"        );\n    }\n    if (click.already) {\n        await confirmPersistedState(page, username, index, command, post, shouldLike);\n        return settled;\n    }\n\n    for (let attempt = 0; attempt < 5; attempt += 1) {\n        await page.sleep(1);\n        if (unwrapEvaluateResult(await page.evaluate(buildReadLikeStateJs(shouldLike))) !== true) continue;\n        // A rejected action reverts the icon shortly after the optimistic flip.\n        await page.sleep(2);\n        if (unwrapEvaluateResult(await page.evaluate(buildReadLikeStateJs(shouldLike))) === true) {\n            await confirmPersistedState(page, username, index, command, post, shouldLike);\n            return [{ status: shouldLike ? 'Liked' : 'Unliked', user: username, post: label }];\n        }\n        break;\n    }\n    throw new CommandExecutionError(\n        `Instagram did not keep the ${shouldLike ? 'like' : 'unlike'} on ${post.code}`,\n        'The action may have been rejected. Retry later, or check the post in the browser.',\n    );\n}\n","sourceCodeStart":201,"sourceCodeEnd":224,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/_shared/post-like.js#L201-L224","documentation":"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.","triggerScenarios":"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.","commonSituations":"Liking too many posts in a short window (action block), session flagged for automation, post deleted or restricted, stale page after navigation.","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"],"exampleFix":"// before\nawait cli.run(['instagram', 'post', 'like', '--code', post.code]);\n// after\ntry {\n  await cli.run(['instagram', 'post', 'like', '--code', post.code]);\n} catch (e) {\n  if (e instanceof CommandExecutionError) await sleep(60_000); // back off, retry later\n  else throw e;\n}","handlingStrategy":"retry","validationCode":"// verify post is reachable and account healthy before the batch\nconst state = await page.evaluate(buildReadLikeStateJs(true));\nif (state === 'rate_limited') throw new Error('back off');","typeGuard":null,"tryCatchPattern":"try {\n  await setInstagramPostLike(opts);\n} catch (e) {\n  if (e instanceof CommandExecutionError && /did not keep the/.test(e.message)) {\n    await sleep(backoffMs); // exponential backoff, retry later\n  } else throw e;\n}","preventionTips":["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"],"tags":["instagram","rate-limit","action-rejected","retry"],"backgroundTag":"instagram-action-rejected","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}