DIYgod/RSSHub · error · ConfigNotFoundError
pixiv not login
Error message
pixiv not login
What it means
Thrown by getNSFWUserNovels when getToken() returns falsy. The refreshToken guard already passed, so the OAuth token refresh itself failed and the in-memory token is null. Same root cause as the series-NSFW login error: configured but non-functional credentials.
Source
Thrown at lib/routes/pixiv/novel-api/user-novels/nsfw.ts:36
headers: {
...maskHeader,
Authorization: 'Bearer ' + token,
},
searchParams: queryString.stringify({
user_id,
filter: 'for_ios',
}),
});
}
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>View on GitHub (pinned to bed535e087)
Solutions
- Regenerate PIXIV_REFRESHTOKEN via the documented login flow and update config.
- Make sure the host can reach oauth.secure.pixiv.net (proxy out of blocked regions).
- Clear the 'pixiv:accessToken' cache entry so the refresh is retried.
- Check RSSHub logs for the pixiv OAuth response error.
Defensive patterns
Strategy: validation
Validate before calling
import { getToken } from '../../token';
const token = await getToken();
if (!token) {
// refresh failed: prompt operator to regenerate PIXIV_REFRESHTOKEN instead of calling getNovels 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-token invalid/expired: clear cache, advise regeneration
}
} Prevention
- Do not call the authenticated app API when getToken() is null; it will 401 upstream.
- Flush 'pixiv:accessToken' on null to avoid an hour of cached failure.
- Log the oauth response to diagnose expiry vs. region block.
When it happens
Trigger: PIXIV_REFRESHTOKEN present but expired/revoked; pixiv oauth endpoint unreachable or rejecting the grant; region-blocked IP; previously cached empty access-token result under 'pixiv:accessToken'.
Common situations: Expired refresh token after prolonged use; server moved to a pixiv-blocked region; stale cache masking a refresh attempt; token obtained from the wrong pixiv account.
Related errors
- pixiv not login
- pixiv not login
- pixiv not login
- pixiv not login
- This user is an R18 creator, PIXIV_REFRESHTOKEN is required.
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/a75dc954ae70525d.
Report an issue: GitHub.