DIYgod/RSSHub · error · Error
日报数据不存在或为空
Error message
日报数据不存在或为空
What it means
The AI Base daily route queries an aILogList endpoint and expects `response.data` to be a non-empty array. If the response is falsy or has no `data` property, it throws a generic `Error('日报数据不存在或为空')`. This is a defensive guard against malformed/empty upstream payloads.
Source
Thrown at lib/routes/aibase/daily.ts:38
const currentHtml = await ofetch(currentUrl);
const $ = load(currentHtml);
const logoSrc = $('img.logo').prop('src');
const image = logoSrc ? new URL(logoSrc, rootUrl).href : '';
const author = 'AI Base';
const { aILogListUrl } = await buildApiUrl($);
const response: DailyData = await ofetch(aILogListUrl, {
headers: {
accept: 'application/json;charset=utf-8',
},
query: {
pagesize: limit,
page: 1,
type: 2,
isen: 0,
},
});
if (!response || !response.data) {
throw new Error('日报数据不存在或为空');
}
const items = await Promise.all(
response.data.slice(0, limit).map(async (item) => {
const articleUrl = `https://www.aibase.com/zh/news/${item.Id}`;
return await cache.tryGet(articleUrl, async () => {
const articleHtml = await ofetch(articleUrl);
const $ = load(articleHtml);
const description = $('.post-content').html();
if (!description) {
throw new Error(`Empty content: ${articleUrl}`);
}
return {
title: item.title,
link: articleUrl,
description,
pubDate: parseDate(item.addtime),
author: 'AI Base',
};View on GitHub (pinned to bed535e087)
Solutions
- Retry later — most often this is a transient rate-limit.
- Verify the aILogListUrl still returns the expected shape (open it directly).
- Inspect the ofetch response status / content-type to distinguish 'empty' from 'blocked'.
Example fix
// before
const response: DailyData = await ofetch(aILogListUrl, { ... });
if (!response || !response.data) throw new Error('日报数据不存在或为空');
// after — surface why it failed
if (!response || !response.data) {
throw new Error(`aibase daily empty: status=${response?.status ?? 'n/a'}, keys=${Object.keys(response ?? {}).join(',')}`);
} Defensive patterns
Strategy: retry
Validate before calling
function looksLikeAibaseDaily(r) {
return r != null && Array.isArray(r.data) && r.data.length > 0;
} Type guard
function isAibaseDailyPayload(r): r is { data: unknown[] } {
return !!r && Array.isArray((r as any).data) && (r as any).data.length > 0;
} Try / catch
let lastErr;
for (let attempt = 0; attempt < 3; attempt++) {
try {
const response = await ofetch(aILogListUrl, { query: { pagesize: limit, page: 1, type: 2, isen: 0 }, headers: { accept: 'application/json;charset=utf-8' } });
if (isAibaseDailyPayload(response)) return response;
lastErr = new Error('aibase daily empty: ' + JSON.stringify(Object.keys(response ?? {})));
} catch (e) { lastErr = e; }
await sleep(1000 * 2 ** attempt); // backoff
}
throw lastErr; Prevention
- Rate-limit your polling of the aibase daily endpoint.
- Inspect HTTP status and content-type to distinguish 'empty' from 'blocked'.
- Cache successful responses with a TTL so transient failures don't cascade.
When it happens
Trigger: The aILogList API returns an error envelope, an empty payload, or an HTML error page (rate-limit / WAF) that ofetch coerced into an object lacking `data`.
Common situations: Rate-limited by aibase.com; the endpoint path or query contract changed; a WAF/challenge page returned non-JSON.
Related errors
- Category not found
- Tag not found
- Unknown asset type: ${content.assetType} in ${item.link}
- Unknown placeholder type: ${placeholder?.type} in ${link}
- Empty content: ${articleUrl}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/78b9f643cfa290c3.
Report an issue: GitHub.