DIYgod/RSSHub · error · Error

${response.return_msg}

Error message

${response.return_msg}

What it means

Thrown by the niaogebiji home route after calling /pc/index/getMoreArticle. The endpoint returns a JSON envelope with return_code; anything other than '200' is treated as a failure and the server's return_msg is re-thrown as a plain Error. This surfaces upstream API errors (rate limiting, maintenance, schema drift) directly to the feed consumer.

Source

Thrown at lib/routes/niaogebiji/index.ts:29

    example: '/niaogebiji',
    radar: [
        {
            source: ['niaogebiji.com/', 'niaogebiji.com/bulletin'],
            target: '',
        },
    ],
    name: '首页',
    maintainers: ['WenryXu'],
    handler,
    url: 'niaogebiji.com/',
};

async function handler() {
    const baseUrl = 'https://www.niaogebiji.com';
    const { data: response } = await got(`${baseUrl}/pc/index/getMoreArticle`);

    if (response.return_code !== '200') {
        throw new Error(response.return_msg);
    }

    const postList = response.return_data.map((item) => ({
        title: item.title,
        description: item.summary,
        author: item.author,
        pubDate: parseDate(item.published_at, 'X'),
        updated: parseDate(item.updated_at, 'X'),
        category: [item.catname, ...item.tag_list],
        link: new URL(item.link, baseUrl).href,
    }));

    const result = await Promise.all(
        postList.map((item) =>
            cache.tryGet(item.link, async () => {
                const { data: response } = await got(item.link);
                const $ = load(response);

View on GitHub (pinned to bed535e087)

Solutions

  1. Read the return_msg value in the error — it usually states the actual cause (rate limit, maintenance, etc.).
  2. If rate-limited, increase the polling interval / cache TTL on the RSSHub route.
  3. If return_msg indicates a contract change, verify the endpoint manually with curl and update the code field check.
  4. Retry after a short backoff for transient upstream failures.

Example fix

// before
if (response.return_code !== '200') {
    throw new Error(response.return_msg);
}

// after — include context for debugging
if (response.return_code !== '200') {
    throw new Error(`niaogebiji API error (${response.return_code}): ${response.return_msg ?? 'unknown'}`);
}
Defensive patterns

Strategy: try-catch

Type guard

const isEnvelopeOk = (r: any): boolean =>
  r && typeof r === 'object' && r.return_code === '200' && Array.isArray(r.return_data);

Try / catch

try {
  const { data } = await got('https://www.niaogebiji.com/pc/index/getMoreArticle');
  if (data.return_code !== '200') throw new Error(`API ${data.return_code}: ${data.return_msg}`);
  // ...process data.return_data
} catch (e) {
  // rate-limited or maintenance — back off and retry with exponential delay
}

Prevention

When it happens

Trigger: niaogebiji.com's getMoreArticle endpoint returns return_code !== '200' — e.g. rate limiting (429-style), server maintenance, a changed response contract, or an internal error on their side. The thrown message is whatever the server put in return_msg.

Common situations: Polling the feed too frequently triggers the site's rate limit; the site is under maintenance; the API contract changed and return_code is now numeric 200 vs string '200'; transient backend errors.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/a131ae6cce07068a. Report an issue: GitHub.