DIYgod/RSSHub · error · Error
No articles found
Error message
No articles found
What it means
Thrown by fetchCollection when the Newslaundry collections API responds with no 'items' array (or an empty one). The route treats a populated items list as a hard precondition before mapping stories into feed entries, so an empty payload is treated as a broken feed rather than a legitimately-empty one. It surfaces as a plain Error, so RSSHub reports it as a route-level failure to the subscriber.
Source
Thrown at lib/routes/newslaundry/utils.tsx:17
import { raw } from 'hono/html';
import { renderToString } from 'hono/jsx/dom/server';
import type { Data, DataItem } from '@/types';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
export const rootUrl = 'https://www.newslaundry.com';
export async function fetchCollection(collectionSlug: string, customUrl?: string, skipFirstItem: boolean = false) {
const apiUrl = `${rootUrl}/api/v1/collections/${collectionSlug}`;
const currentUrl = customUrl || `${rootUrl}/${collectionSlug}`;
const response = await ofetch(apiUrl);
if (!response.items || !response.items.length) {
throw new Error('No articles found');
}
// Skip first item if requested
const itemsToProcess = skipFirstItem ? response.items.slice(1) : response.items;
const items = itemsToProcess.map((item) => processStory(item.story));
return {
title: `${response.name} - Newslaundry`,
description: response.summary || `${response.name} articles from Newslaundry`,
link: currentUrl,
item: items,
language: 'en',
logo: `${rootUrl}/favicon.ico`,
icon: `${rootUrl}/favicon.ico`,
} as Data;
}
function processStory(story: any): DataItem {View on GitHub (pinned to bed535e087)
Solutions
- Confirm the collectionSlug still exists by opening https://www.newslaundry.com/api/v1/collections/{slug} in a browser and checking that items[] is populated.
- If the slug changed, update the route path/example and any callers passing collectionSlug to the current value.
- Reproduce the raw response with curl/config.trueUA to detect anti-bot interstitials; if blocked, the instance may need a different egress IP or proxy.
- Consider widening the guard so a missing-items response carries diagnostic detail (e.g. log response.name or the HTTP status) instead of a bare 'No articles found'.
Example fix
// before
const response = await ofetch(apiUrl);
if (!response.items || !response.items.length) {
throw new Error('No articles found');
}
// after
const response = await ofetch(apiUrl);
if (!response.items || !response.items.length) {
throw new Error(`No articles found for collection "${collectionSlug}" (api: ${apiUrl})`);
} Defensive patterns
Strategy: validation
Validate before calling
// Before calling fetchCollection, sanity-check the slug shape and probe the API surface.
async function collectionExists(slug: string): Promise<boolean> {
try {
const res = await ofetch(`https://www.newslaundry.com/api/v1/collections/${slug}`, { timeout: 10000 });
return Array.isArray(res?.items) && res.items.length > 0;
} catch {
return false;
}
}
if (!(await collectionExists(slug))) {
// surface a friendly 'feed unavailable' instead of letting the throw propagate
} Type guard
const hasItems = (r: unknown): r is { items: unknown[] } =>
typeof r === 'object' && r !== null && Array.isArray((r as any).items) && (r as any).items.length > 0; Try / catch
// In the route handler, downgrade a 'No articles found' into an empty-but-valid feed when appropriate.
try {
return await fetchCollection(slug, customUrl, skipFirst);
} catch (e) {
if (e instanceof Error && e.message === 'No articles found') {
return { title: `${slug} - Newslaundry`, description: 'No articles available.', link: customUrl ?? `${rootUrl}/${slug}`, item: [], allowEmpty: true };
}
throw e;
} Prevention
- Treat an empty items array as a possible transient outage and retry once before failing.
- Log the raw API status/body when items is empty so root cause (block vs rename) is distinguishable.
- Cache only non-empty results so a transient empty response does not poison the feed.
When it happens
Trigger: A GET to https://www.newslaundry.com/api/v1/collections/{collectionSlug} where the JSON body omits 'items' or returns items: []. This happens when collectionSlug is misspelled/decommissioned, when Newslaundry returns an error object that lacks items, or when anti-bot/Cloudflare middleware returns a 200 with an interstitial/empty body.
Common situations: A collection slug renamed or retired on the Newslaundry site; the upstream CMS (Quintype assettype) changed its API response envelope; the instance's egress IP is rate-limited and gets a stripped-down 200 response; a transient outage returns an error JSON that ofetch parsed successfully but without items.
Related errors
- Unknown post type: ${type}
- Creator not found
- The user does not exist.
- No Calls for Papers found
- Category "${categorySlug}" not found
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/54d28476fbb7d6a1.
Report an issue: GitHub.