{"record":{"id":"a167ea094ed0b41f","repo":"jackwener/OpenCLI","slug":"instagram-did-not-persist-the-shouldlike-like","errorCode":null,"errorMessage":"Instagram did not persist the ${shouldLike ? 'like' : 'unlike'} on ${expectedPost.code}","messagePattern":"Instagram did not persist the (.+?) on (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/instagram/_shared/post-like.js","lineNumber":166,"sourceCode":"    const post = snapshot.posts[index - 1];\n    if (!post) {\n        throw new EmptyResultError(command, snapshot.posts.length === 0\n            ? `No visible posts for ${username}; check the username and whether the account is private.`\n            : `Post index ${index} not found; ${username} has ${snapshot.posts.length} recent posts.`);\n    }\n    return post;\n}\n\nasync function confirmPersistedState(page, username, index, command, expectedPost, shouldLike) {\n    const confirmed = pickPost(await readPostSnapshot(page, username, index, command), username, index, command);\n    if (confirmed.code !== expectedPost.code || confirmed.pk !== expectedPost.pk) {\n        throw new CommandExecutionError(\n            `Instagram post feed no longer shows the expected post ${expectedPost.code} at index ${index}`,\n            'The profile feed may have re-rendered or changed order; retry after checking the post in the browser.',\n        );\n    }\n    if (confirmed.liked !== shouldLike) {\n        throw new CommandExecutionError(\n            `Instagram did not persist the ${shouldLike ? 'like' : 'unlike'} on ${expectedPost.code}`,\n            'The action may have been rejected. Retry later, or check the post in the browser.',\n        );\n    }\n    return confirmed;\n}\n\nexport async function setInstagramPostLike(page, kwargs, shouldLike) {\n    const username = String(kwargs.username || '').trim();\n    const index = kwargs.index;\n    const command = shouldLike ? 'instagram like' : 'instagram unlike';\n    if (!username) {\n        throw new ArgumentError('username is required');\n    }\n    if (!Number.isInteger(index) || index < 1) {\n        throw new ArgumentError('--index must be a positive integer', 'e.g. --index 2 for the second most recent post');\n    }\n","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/_shared/post-like.js#L148-L184","documentation":"After clicking the like control, confirmPersistedState re-reads the snapshot and checks that the post's liked flag now equals the desired state. This throw fires when the click was found and performed but the state did not persist — Instagram silently rejected the action (e.g. rate limiting, login wall, action blocked).","triggerScenarios":"click.already or click.found succeeded but the follow-up snapshot still shows liked !== shouldLike — Instagram's like endpoint failed server-side, the account is action-blocked/rate-limited, or the click hit a login prompt overlay that ate the event.","commonSituations":"Liking too many posts too quickly triggering Instagram rate limiting; session expired mid-run so clicks go to a login overlay; bot-detection shadow-rejecting the action; temporary Instagram server errors.","solutions":["Wait and retry later — rejection is often temporary rate limiting","Verify the session is still logged in (manually open the post in the automated browser)","Slow down automation: add sleeps between actions and reduce like volume","Check whether the account is action-blocked by Instagram and stop automating until the block lifts"],"exampleFix":"null","handlingStrategy":"retry","validationCode":"// confirm the session can like by checking a known liked state first\nconst snap = await readPostSnapshot(page, username, index, command);\nif (!snap.posts.length) throw new Error('no posts; session may be limited');","typeGuard":null,"tryCatchPattern":"try { await setInstagramPostLike(page, kwargs, true); } catch (e) { if (/did not persist/.test(e.message)) { await sleep(60000); /* back off, then retry once */ } else throw e; }","preventionTips":["Rate-limit like/unlike actions (e.g. one per several seconds)","Keep the browser session logged in and human-like (no aggressive headless flags)","Stop and back off if rejections repeat — the account may be action-blocked","Verify manually in the browser that likes are sticking before resuming automation"],"tags":["instagram","rate-limiting","persistence-check"],"backgroundTag":"action-not-persisted","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}