DIYgod/RSSHub · warning · Error

No novels found for this user, or is an R18 creator, fallbac

Error message

No novels found for this user, or is an R18 creator, fallback to ConfigNotFoundError

What it means

Plain Error thrown by the SFW (unauthenticated) user-novels path when /ajax/user/{id}/profile/all returns no novel keys. It is deliberately a generic Error (name 'Error'), not ConfigNotFoundError, so the novels.ts handler can catch it by error.name and fall back to the NSFW path. The message explicitly says it is a fallback signal.

Source

Thrown at lib/routes/pixiv/novel-api/user-novels/sfw.ts:23

import { getSFWNovelContent } from '../content/sfw';
import type { NovelList, SFWNovelsResponse } from './types';

const baseUrl = 'https://www.pixiv.net';

export async function getSFWUserNovels(id: string, fullContent: boolean = false, limit: number = 100): Promise<NovelList> {
    const url = `${baseUrl}/users/${id}/novels`;
    const { data: allData } = await got(`${baseUrl}/ajax/user/${id}/profile/all`, {
        headers: {
            referer: url,
        },
    });

    const novels = Object.keys(allData.body.novels)
        .toSorted((a, b) => Number(b) - Number(a))
        .slice(0, Number(String(limit)));

    if (novels.length === 0) {
        throw new Error('No novels found for this user, or is an R18 creator, fallback to ConfigNotFoundError');
    }

    const searchParams = new URLSearchParams();
    for (const novel of novels) {
        searchParams.append('ids[]', novel);
    }

    const { data } = (await got(`${baseUrl}/ajax/user/${id}/profile/novels`, {
        headers: {
            referer: url,
        },
        searchParams,
    })) as SFWNovelsResponse;

    const items = await Promise.all(
        Object.values(data.body.works).map(async (item) => {
            const baseItem = {
                title: item.title,

View on GitHub (pinned to bed535e087)

Solutions

  1. If the author is R18, set PIXIV_REFRESHTOKEN so the NSFW path is used (the novels handler auto-detects this Error and tries NSFW).
  2. Confirm the user ID is valid and the account has novels on pixiv.
  3. If configuring the token is not an option, accept that R18-only authors cannot be served by the SFW path.
  4. Do not surface this raw message to end users; it is internal control flow.
Defensive patterns

Strategy: try-catch

Validate before calling

// SFW path may legitimately return zero novels; pre-validate only the ID shape.
function isValidPixivUserId(id: string): boolean {
  return /^\d+$/.test(id);
}
if (!isValidPixivUserId(id)) {
  // reject before hitting profile/all
}

Type guard

const isEmptyNovelProfile = (d: any): boolean =>
  d && d.body && (!d.body.novels || Object.keys(d.body.novels).length === 0);

Try / catch

// this Error is intentional control flow in novels.ts:
try {
  nonR18Result = await getSFWUserNovels(id, fullContent, limit);
} catch (error: any) {
  if (error.name !== 'Error') throw error; // only swallow the generic SFW-empty signal
  nonR18Result = null;
}

Prevention

When it happens

Trigger: The user has no SFW-visible novels; the user is an R18 creator whose works only appear via the authenticated app API; the profile/all endpoint returned an empty novels object for a valid account.

Common situations: Operator has not configured PIXIV_REFRESHTOKEN and requests an R18-only author; brand-new account with no novels; account that deleted all public works.

Related errors


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