{"record":{"id":"e2badf9f032e0f1a","repo":"jackwener/OpenCLI","slug":"no-visible-posts-for-username-check-the-userna","errorCode":null,"errorMessage":"No visible posts for ${username}; check the username and whether the account is private.","messagePattern":"No visible posts for (.+?); check the username and whether the account is private\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/instagram/_shared/post-like.js","lineNumber":150,"sourceCode":"        return {\n            code,\n            pk,\n            caption: typeof item.caption === 'string' ? item.caption : '',\n            liked: item.liked,\n        };\n    });\n    return { ownerId, posts };\n}\n\nasync function readPostSnapshot(page, username, index, command) {\n    const feed = unwrapEvaluateResult(await page.evaluate(buildReadPostsJs(username, index)));\n    return normalizeFeedSnapshot(feed, command, username);\n}\n\nfunction pickPost(snapshot, username, index, command) {\n    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.',","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/_shared/post-like.js#L132-L168","documentation":"pickPost looks up snapshot.posts[index - 1] and throws EmptyResultError when no post exists at that position and the snapshot contains zero posts. This is a deliberate, user-facing empty-result signal: the profile grid yielded nothing to operate on, most often because the account is private, the username is wrong, or the session cannot see the profile.","triggerScenarios":"Calling instagram like/unlike with a username whose profile feed resolves to an empty items array — misspelled username, private account without following, suspended/deleted account, or region-blocked profile.","commonSituations":"Typo in the target username; scraping an account that has since gone private; logged-out session where Instagram hides the grid; brand-new account with zero posts.","solutions":["Verify the username spelling and that the profile is public (or that you follow it)","Confirm the browser session is logged in and can see the profile grid manually","Pick an account that has at least one visible post","If the account genuinely has no posts, treat this as an expected empty result rather than retrying"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"if (!username || typeof username !== 'string') throw new Error('username required');\n// optionally pre-check visibility by loading https://www.instagram.com/<username>/ and asserting the grid renders","typeGuard":null,"tryCatchPattern":"try { await setInstagramPostLike(page, kwargs, true); } catch (e) { if (e instanceof EmptyResultError || /No visible posts/.test(e.message)) { console.warn(`Account ${kwargs.username} has no visible posts — check spelling/privacy`); } else throw e; }","preventionTips":["Validate the username against a known-good list before automating","Confirm the target account is public or followed by the session","Manually visit the profile once to confirm it has visible posts","Treat this as an expected result, not a bug — do not blind-retry"],"tags":["instagram","empty-result","user-input"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}