jackwener/OpenCLI · warning · EmptyResultError

No visible posts for ${username}; check the username and whe

Error message

No visible posts for ${username}; check the username and whether the account is private.

What it means

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.

Source

Thrown at clis/instagram/_shared/post-like.js:150

        return {
            code,
            pk,
            caption: typeof item.caption === 'string' ? item.caption : '',
            liked: item.liked,
        };
    });
    return { ownerId, posts };
}

async function readPostSnapshot(page, username, index, command) {
    const feed = unwrapEvaluateResult(await page.evaluate(buildReadPostsJs(username, index)));
    return normalizeFeedSnapshot(feed, command, username);
}

function pickPost(snapshot, username, index, command) {
    const post = snapshot.posts[index - 1];
    if (!post) {
        throw new EmptyResultError(command, snapshot.posts.length === 0
            ? `No visible posts for ${username}; check the username and whether the account is private.`
            : `Post index ${index} not found; ${username} has ${snapshot.posts.length} recent posts.`);
    }
    return post;
}

async function confirmPersistedState(page, username, index, command, expectedPost, shouldLike) {
    const confirmed = pickPost(await readPostSnapshot(page, username, index, command), username, index, command);
    if (confirmed.code !== expectedPost.code || confirmed.pk !== expectedPost.pk) {
        throw new CommandExecutionError(
            `Instagram post feed no longer shows the expected post ${expectedPost.code} at index ${index}`,
            'The profile feed may have re-rendered or changed order; retry after checking the post in the browser.',
        );
    }
    if (confirmed.liked !== shouldLike) {
        throw new CommandExecutionError(
            `Instagram did not persist the ${shouldLike ? 'like' : 'unlike'} on ${expectedPost.code}`,
            'The action may have been rejected. Retry later, or check the post in the browser.',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the username spelling and that the profile is public (or that you follow it)
  2. Confirm the browser session is logged in and can see the profile grid manually
  3. Pick an account that has at least one visible post
  4. If the account genuinely has no posts, treat this as an expected empty result rather than retrying

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

if (!username || typeof username !== 'string') throw new Error('username required');
// optionally pre-check visibility by loading https://www.instagram.com/<username>/ and asserting the grid renders

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/e2badf9f032e0f1a. Report an issue: GitHub.