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

No posts were returned for topic ${args.id}. Confirm the top

Error message

No posts were returned for topic ${args.id}. Confirm the topic ID and login state.

What it means

The jike topic CLI loads https://m.okjike.com/topics/<id> and extracts posts from an embedded JSON script. If the extraction succeeds structurally but the posts array is empty, it throws EmptyResultError telling the user the topic yielded no posts and to verify the ID and login state. This distinguishes 'page loaded but nothing there' from parse failures.

Source

Thrown at clis/jike/topic.js:46

    const data = JSON.parse(el.textContent || '{}');
    const pageProps = data?.props?.pageProps || {};
    const posts = Array.isArray(pageProps.posts) ? pageProps.posts : [];
    return posts.map(p => ({
      content: (p.content || '').replace(/\\n/g, ' ').slice(0, 80),
      author: p.user?.screenName || '',
      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 topic', `No posts were returned for topic ${args.id}. Confirm the topic ID and login state.`);
            }
            return data.slice(0, limit).map((item) => ({
                content: item.content ?? '',
                author: item.author ?? '',
                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 topic page did not expose the expected data script');
        }
        if (data?.reason === 'parse-error') {
            throw new CommandExecutionError(`Failed to parse Jike topic data: ${data.message || 'unknown error'}`);
        }
        throw new CommandExecutionError('Jike topic returned an unreadable payload');
    },

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the topic ID against the topic URL (e.g. 553870e8e4b0cafb0a1bef68).
  2. Re-login to Jike so the embedded JSON includes posts for logged-in content.
  3. Open the topic URL in a normal browser to confirm posts exist; if not, the topic is gone/private.
  4. Catch EmptyResultError and treat as 'no posts' rather than a hard failure.

Example fix

// before
const rows = await runCli(['jike', 'topic', topicId]);
// after
try {
  const rows = await runCli(['jike', 'topic', topicId]);
} catch (e) {
  if (e.name === 'EmptyResultError') { console.warn('topic empty or inaccessible'); return []; }
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// sanity-check topic id format before calling
const isTopicId = (id) => typeof id === 'string' && /^[0-9a-f]{24}$/.test(id);

Try / catch

try {
  return await runCli(['jike', 'topic', id]);
} catch (e) {
  if (e.name === 'EmptyResultError') { console.warn('topic empty, deleted, or needs login'); return []; }
  throw e;
}

Prevention

When it happens

Trigger: The page's pageProps.posts array is empty — nonexistent or deleted topic ID, private/restricted topic, or a logged-out/limited session where the server renders zero posts.

Common situations: Copied a wrong/truncated topic ID from the URL; topic was deleted or made private; cookie session expired so m.okjike.com serves a logged-out shell with no posts; region-restricted content.

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