DIYgod/RSSHub · error · ConfigNotFoundError

This user may not have any novel works, or is an R18 creator

Error message

This user may not have any novel works, or is an R18 creator, PIXIV_REFRESHTOKEN is required.
pixiv RSS is disabled due to the lack of relevant config.
該用戶可能沒有小說作品,或者該用戶爲 R18 創作者,需要 PIXIV_REFRESHTOKEN。

What it means

ConfigNotFoundError thrown at the end of the /pixiv/user/novels/:id handler when there is no pixiv auth AND the SFW path failed with a generic Error. The handler first tries getNSFWUserNovels if auth exists, else tries getSFWUserNovels; if SFW throws a plain Error it is swallowed (nonR18Result=null), and this final throw reports the ambiguity: the user may have no novels, or may be R18-only and need a token.

Source

Thrown at lib/routes/pixiv/novels.ts:99

    if (hasPixivAuth()) {
        return await getNSFWUserNovels(id, fullContent, limit);
    }

    let nonR18Result;
    try {
        nonR18Result = await getSFWUserNovels(id, fullContent, limit);
    } catch (error: any) {
        if (error.name !== 'Error') {
            throw error;
        }
        nonR18Result = null;
    }

    if (nonR18Result) {
        return nonR18Result;
    }

    throw new ConfigNotFoundError(
        'This user may not have any novel works, or is an R18 creator, PIXIV_REFRESHTOKEN is required.\npixiv RSS is disabled due to the lack of relevant config.\n該用戶可能沒有小說作品,或者該用戶爲 R18 創作者,需要 PIXIV_REFRESHTOKEN。'
    );
}

View on GitHub (pinned to bed535e087)

Solutions

  1. Configure PIXIV_REFRESHTOKEN so the NSFW branch handles R18 authors (the handler prefers it when present).
  2. Verify the user actually has novels on pixiv (SFW-visible).
  3. Confirm the user ID is correct.
  4. If the author is known SFW but empty, the feed is legitimately empty and the token will not help.
Defensive patterns

Strategy: validation

Validate before calling

import { config } from '@/config';
const hasPixivAuth = () => Boolean(config.pixiv && config.pixiv.refreshToken);
// in the handler, prefer NSFW when auth exists to avoid reaching this terminal throw:
if (hasPixivAuth()) {
  return await getNSFWUserNovels(id, fullContent, limit);
}

Type guard

const isConfigNotFound = (e: unknown): e is Error =>
  e instanceof Error && (e as any).name === 'ConfigNotFoundError';

Try / catch

try {
  // ...SFW attempt already wrapped internally...
} catch (e) {
  if (e instanceof ConfigNotFoundError && /PIXIV_REFRESHTOKEN/.test(e.message)) {
    // terminal: either no novels or R18-only author; advise token configuration
  }
}

Prevention

When it happens

Trigger: No PIXIV_REFRESHTOKEN configured, and the SFW user-novels fetch returned zero novels (either truly none, or all R18-gated). This is the terminal error after both branches are exhausted.

Common situations: Requesting an R18-only author without credentials; requesting a user with no novels at all; credentials removed since last successful fetch.

Related errors


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