DIYgod/RSSHub · error · Error
无法解析页面 Props 数据
Error message
无法解析页面 Props 数据
What it means
After successfully extracting and parsing the __NEXT_DATA__ JSON from comic-fuz, the expected nextData.props.pageProps object is missing. This means Next.js rendered a page with hydration data but the route's data payload (pageProps) was not populated, typically indicating an error or redirect state rendered server-side.
Source
Thrown at lib/routes/comic-fuz/manga.ts:52
const response = await ofetch(openUrl, {
headers: {
'Accept-Language': 'ja,en-US;q=0.9,en;q=0.8',
},
});
const $ = load(response);
const nextDataText = $('#__NEXT_DATA__').text();
if (!nextDataText) {
throw new Error('无法解析页面数据,请检查漫画 ID 是否正确或页面结构是否变动');
}
const nextData = JSON.parse(nextDataText);
const pageProps = nextData.props?.pageProps;
if (!pageProps) {
throw new Error('无法解析页面 Props 数据');
}
const mangaTitle = $('title').text();
const mangaAuthor = pageProps.authorships?.map((item: any) => item.author?.authorName).join(', ') || '';
const mangaDescription = pageProps.manga?.longDescription || '';
const chapterGroups = pageProps.chapters || [];
const allChapters = chapterGroups.flatMap((group: any) => group.chapters || []);
const items = allChapters.map((chapter: any) => {
const pointInfo = chapter.pointConsumption;
const amount = pointInfo?.amount || 0;
let statusText = '';
if (pointInfo && Object.keys(pointInfo).length === 0) {
statusText = '无料';
} else if (amount > 0) {View on GitHub (pinned to bed535e087)
Solutions
- Log the full nextData object to inspect which props are actually present — the structure may have changed.
- Verify the manga ID by visiting the page in a browser and checking the Network tab for the actual pageProps shape.
- If the site migrated to Next.js App Router, pageProps may no longer exist — look for a different data embedding pattern.
- Add a more specific error message that includes the manga ID to help users self-diagnose.
Example fix
// before
const nextData = JSON.parse(nextDataText);
const pageProps = nextData.props?.pageProps;
if (!pageProps) {
throw new Error('无法解析页面 Props 数据');
}
// after — expose available keys for diagnosis
const nextData = JSON.parse(nextDataText);
const pageProps = nextData.props?.pageProps;
if (!pageProps) {
const availableKeys = Object.keys(nextData.props || {});
throw new Error(`pageProps missing in __NEXT_DATA__; available prop keys: ${availableKeys.join(', ')}`);
} Defensive patterns
Strategy: validation
Validate before calling
const nextData = JSON.parse(nextDataText);
if (!nextData.props?.pageProps) {
// Log available structure for diagnosis
logger.warn(`pageProps missing. Available keys in nextData: ${Object.keys(nextData).join(', ')}`);
throw new Error('pageProps not found in __NEXT_DATA__');
} Type guard
function hasPageProps(nextData: any): nextData is { props: { pageProps: Record<string, unknown> } } {
return nextData != null && typeof nextData === 'object' && nextData.props != null && typeof nextData.props.pageProps === 'object';
} Try / catch
try {
const nextData = JSON.parse(nextDataText);
const pageProps = nextData.props?.pageProps;
if (!pageProps) throw new Error('pageProps missing');
} catch (e) {
if (e instanceof SyntaxError) {
throw new Error('Failed to parse __NEXT_DATA__ JSON');
}
throw e;
} Prevention
- Validate JSON.parse results with try-catch to distinguish parse errors from missing-field errors.
- Use optional chaining consistently when traversing nested data from scraped pages.
- Log the available structure when validation fails to aid future debugging.
When it happens
Trigger: The __NEXT_DATA__ JSON exists and parses, but nextData.props.pageProps is undefined or null. This occurs when the server renders an error boundary page (e.g., manga not found) that still includes __NEXT_DATA__ for framework bootstrapping but without the expected page-level props.
Common situations: The manga ID was valid at one point but has been removed or made private; the site's Next.js app routing changed and pageProps is now nested differently (e.g., under a different key); a transient server error caused Next.js to render without props.
Related errors
- 无法解析页面数据,请检查漫画 ID 是否正确或页面结构是否变动
- 无法解析页面 HTML 数据,可能触发了反爬策略或页面结构巨变
- 成功获取数据对象,但未找到作品基本信息
- 无法在 HTML 缓存中提取核心数据对象
- HTML 缓存中无章节!
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/7f21b8f5ccb38be4.
Report an issue: GitHub.