jackwener/OpenCLI · warning · EmptyResultError('jike user')

No posts were returned for user

Error message

No posts were returned for user ${args.username}. Confirm the username and login state.

What it means

EmptyResultError thrown when the Jike user page scrape returns a successful JSON array with zero posts. The CLI treats an empty result as a distinct condition so the user knows the extraction worked but matched nothing, typically because the username is wrong or the account requires login to view posts.

Solutions

  1. Verify the username by opening https://web.okjike.com/<username> in a browser and confirming posts appear
  2. Log into Jike in the browser session (or the persisted profile) so authenticated content is visible
  3. Try a different username to confirm the target account actually has original posts
  4. Retry later if Jike is serving an empty/degraded page

Example fix

// before
await jikeUser({ username: 'nonexistent_user', limit: 10 });
// after
// verify in browser first
await jikeUser({ username: 'correct_username', limit: 10 });
Defensive patterns

Strategy: try-catch

Validate before calling

const u = args.username;
if (!u || typeof u !== 'string' || !/^[A-Za-z0-9_-]+$/.test(u)) {
  throw new Error('Provide a valid Jike username');
}

Type guard

function hasPosts(d) { return Array.isArray(d) && d.length > 0; }

Try / catch

try {
  const posts = await jikeUser({ username, limit });
} catch (e) {
  if (e.name === 'EmptyResultError') console.warn(`No posts for ${username}; check username/login`);
  else throw e;
}

Prevention

When it happens

Trigger: Running the `jike user` command with a username whose profile returns no post data: a nonexistent or misspelled username, a private/restricted account, or a logged-out page where Jike hides original posts.

Common situations: Typo in the username argument; scraping an account with no public original posts; Jike web serving a login wall for anonymous visitors; a username that was changed or deactivated.

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/dcc5eecce17689f0. Report an issue: GitHub.

Appendix: source

Thrown at clis/jike/user.js:45

  try {
    const data = JSON.parse(el.textContent || '{}');
    const posts = Array.isArray(data?.props?.pageProps?.posts) ? data.props.pageProps.posts : [];
    return posts.map(p => ({
      content: (p.content || '').replace(/\\n/g, ' ').slice(0, 80),
      type: p.type === 'ORIGINAL_POST' ? 'post' : p.type === 'REPOST' ? 'repost' : p.type || '',
      likes: p.likeCount || 0,
      comments: p.commentCount || 0,
      time: p.actionTime || p.createdAt || '',
      id: p.id || '',
    }));
  } catch (e) {
    return { ok: false, reason: 'parse-error', message: e?.message || String(e) };
  }
})()
`);
        if (Array.isArray(data)) {
            if (data.length === 0) {
                throw new EmptyResultError('jike user', `No posts were returned for user ${args.username}. Confirm the username and login state.`);
            }
            return data.slice(0, limit).map((item) => ({
                id: item.id ?? '',
                content: item.content ?? '',
                type: item.type ?? '',
                likes: item.likes ?? 0,
                comments: item.comments ?? 0,
                time: item.time ?? '',
                url: `https://web.okjike.com/originalPost/${item.id ?? ''}`,
            }));
        }
        if (data?.reason === 'missing-data-script') {
            throw new CommandExecutionError('Jike user page did not expose the expected data script');
        }
        if (data?.reason === 'parse-error') {
            throw new CommandExecutionError(`Failed to parse Jike user data: ${data.message || 'unknown error'}`);
        }
        throw new CommandExecutionError('Jike user returned an unreadable payload');

View on GitHub (pinned to 49907e53dc)