DIYgod/RSSHub · warning · InvalidParameterError

${id} is not a valid user ID, or the user has no novels. ${i

Error message

${id} is not a valid user ID, or the user has no novels.
${id} 不是有效的用戶 ID,或者該用戶沒有小說作品。

What it means

InvalidParameterError thrown by getNSFWUserNovels after the authenticated /v1/user/novels call returns an empty novels array. Because auth already succeeded, an empty list means the user ID is wrong/deleted or the user genuinely has no novel works. The message is bilingual and names the offending id.

Source

Thrown at lib/routes/pixiv/novel-api/user-novels/nsfw.ts:43

        }),
    });
}

export async function getNSFWUserNovels(id: string, fullContent: boolean = false, limit: number = 100): Promise<NovelList> {
    if (!config.pixiv || !config.pixiv.refreshToken) {
        throw new ConfigNotFoundError('This user is an R18 creator, PIXIV_REFRESHTOKEN is required.\npixiv RSS is disabled due to the lack of relevant config.\n該用戶爲 R18 創作者,需要 PIXIV_REFRESHTOKEN。');
    }

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

    const response = await getNovels(id, token);
    const novels = limit ? response.data.novels.slice(0, limit) : response.data.novels;

    if (novels.length === 0) {
        throw new InvalidParameterError(`${id} is not a valid user ID, or the user has no novels.\n${id} 不是有效的用戶 ID,或者該用戶沒有小說作品。`);
    }

    const username = novels[0].user.name;

    const items = await Promise.all(
        novels.map(async (novel) => {
            const baseItem = {
                title: novel.series?.title ? `${novel.series.title} - ${novel.title}` : novel.title,
                description: `
                    <img src="${pixivUtils.getProxiedImageUrl(novel.image_urls.large)}" />
                    <div>
                    <p>${convertPixivProtocolExtended(novel.caption)}</p>
                    </div>`,
                author: novel.user.name,
                pubDate: parseDate(novel.create_date),
                link: `https://www.pixiv.net/novel/show.php?id=${novel.id}`,
                category: novel.tags.map((t) => t.name),
            };

View on GitHub (pinned to bed535e087)

Solutions

  1. Confirm the id matches the numeric segment of https://www.pixiv.net/users/{id}/novels.
  2. Open the user's profile and verify they have a Novels tab with works.
  3. If the ID came from a third-party link, double-check it is the pixiv user ID and not an artwork or series ID.
  4. Retry after confirming the account still exists.
Defensive patterns

Strategy: validation

Validate before calling

function isValidPixivUserId(id: string): boolean {
  return /^\d+$/.test(id) && id.length > 0;
}
// before fetching:
if (!isValidPixivUserId(id)) {
  // reject as invalid user ID
}

Type guard

const hasNovels = (resp: { data?: { novels?: unknown[] } }): boolean =>
  Array.isArray(resp.data?.novels) && resp.data.novels.length > 0;

Try / catch

try {
  return await getNSFWUserNovels(id, fullContent, limit);
} catch (e) {
  if (e instanceof InvalidParameterError && /not a valid user ID/.test(e.message)) {
    // user has no novels or ID is wrong: show the bilingual hint, do not retry
  }
  throw e;
}

Prevention

When it happens

Trigger: Passing a non-existent or deleted pixiv user ID; a valid user who has published zero novels; a user whose only works are filtered out server-side.

Common situations: Copied a pixiv illust-only user ID into a novels route; ID typo; user deleted all novels; numeric ID truncated during copy.

Related errors


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