jackwener/OpenCLI · error · CommandExecutionError
Jike topic page did not expose the expected data script
Error message
Jike topic page did not expose the expected data script
What it means
The topic CLI scrapes data from a <script type="application/json"> tag injected by the m.okjike.com page. When no such script element exists in the DOM, the in-page evaluate returns {reason:'missing-data-script'} and the CLI throws CommandExecutionError. This means the page did not render in the expected Next.js/SSR shape.
Source
Thrown at clis/jike/topic.js:58
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
- Re-login to Jike to eliminate login-wall redirects, then retry.
- Open https://m.okjike.com/topics/<id> in a browser and inspect whether script[type="application/json"] still exists.
- Retry later if a bot-check/CAPTCHA interstitial is being served.
- Update the CLI/package if Jike changed the page structure permanently.
Example fix
// before
const el = document.querySelector('script[type="application/json"]');
if (!el) return { ok: false, reason: 'missing-data-script' };
// after: also try __NEXT_DATA__ by id
const el = document.querySelector('script#__NEXT_DATA__') || document.querySelector('script[type="application/json"]');
if (!el) return { ok: false, reason: 'missing-data-script' }; Defensive patterns
Strategy: retry
Validate before calling
// confirm session is live and page renders before scraping
await page.goto(url, { waitUntil: 'domcontentloaded' });
if (await page.$('script[type="application/json"]') === null) await page.reload(); Try / catch
try {
return await runCli(['jike', 'topic', id]);
} catch (e) {
if (/did not expose the expected data script/.test(e.message) && attempt < 3) return retryAfterLogin();
throw e;
} Prevention
- Keep Jike cookies fresh to avoid login-wall HTML without the data script.
- Reload/Re-check the page when Jike deploys front-end changes.
- Detect bot-check/CAPTCHA interstitials before evaluating scripts.
- Pin/update the scraper when m.okjike.com markup changes.
When it happens
Trigger: page.evaluate finds no script[type="application/json"] — e.g. the page served a login wall, an error page, a bot-check/CAPTCHA, or Jike redesigned the page to use a different data mechanism.
Common situations: Expired cookies causing a redirect to a login page; Jike front-end upgrade replacing the JSON script tag; anti-bot interstitial; network issues serving a partial/HTML error page.
Related errors
- Failed to extract Booking.com cards: ${err?.message || err}
- No visible Claude messages were found for conversation ${id}
- No Claude conversation history was visible on /recents.
- No visible Claude messages were found in the current convers
- coupang search extraction failed: ${error?.message || error}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/3d82f8928297de27.
Report an issue: GitHub.