DIYgod/RSSHub · error · ConfigNotFoundError

pixiv not login

Error message

pixiv not login

What it means

ConfigNotFoundError thrown by the search handler when getToken() returns falsy. The refresh-token guard passed, so the OAuth refresh itself failed and no access token is available for the search API call.

Source

Thrown at lib/routes/pixiv/search.ts:92

    },
    name: 'Keyword',
    maintainers: ['DIYgod'],
    handler,
};

async function handler(ctx) {
    if (!config.pixiv || !config.pixiv.refreshToken) {
        throw new ConfigNotFoundError('pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config</a>');
    }

    const keyword = ctx.req.param('keyword');
    const order = ctx.req.param('order') || 'date';
    const mode = ctx.req.param('mode');
    const includeAI = ctx.req.param('include_ai');

    const token = await getToken();
    if (!token) {
        throw new ConfigNotFoundError('pixiv not login');
    }

    const response = await (order === 'popular' ? searchPopularIllust(keyword, token) : searchIllust(keyword, token));

    let illusts = response.data.illusts;
    if (mode === 'safe' || mode === '1') {
        illusts = illusts.filter((item) => item.x_restrict === 0);
    } else if (mode === 'r18' || mode === '2') {
        illusts = illusts.filter((item) => item.x_restrict === 1);
    }

    if (includeAI === 'no' || includeAI === '0') {
        illusts = illusts.filter((item) => item.illust_ai_type <= 1);
    }

    return {
        title: `${keyword} 的 pixiv ${order === 'popular' ? '热门' : ''}内容`,
        link: `https://www.pixiv.net/tags/${keyword}/artworks`,

View on GitHub (pinned to bed535e087)

Solutions

  1. Obtain a new PIXIV_REFRESHTOKEN and replace the configured value.
  2. Ensure oauth.secure.pixiv.net is reachable from the host.
  3. Clear the 'pixiv:accessToken' cache to force a fresh refresh.
  4. Read the pixiv oauth error from logs.
Defensive patterns

Strategy: validation

Validate before calling

import { getToken } from './token';
const token = await getToken();
if (!token) {
  // abort search; refresh failed, regenerate PIXIV_REFRESHTOKEN
}

Type guard

const isUsableToken = (t: unknown): t is string => typeof t === 'string' && t.length > 0;

Try / catch

try {
  const token = await getToken();
  if (!token) throw new ConfigNotFoundError('pixiv not login');
} catch (e) {
  if (e instanceof ConfigNotFoundError) {
    // refresh failed: clear cache, advise token regeneration
  }
}

Prevention

When it happens

Trigger: PIXIV_REFRESHTOKEN present but expired, revoked, or rejected by pixiv oauth; network/region block; cached empty token under 'pixiv:accessToken'.

Common situations: Stale/expired refresh token; server IP blocked by pixiv; failed refresh cached for an hour.

Related errors


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