DIYgod/RSSHub · error · ConfigNotFoundError

Weibo user bookmarks is not available due to the absense of

Error message

Weibo user bookmarks is not available due to the absense of [Weibo Cookies]. Check <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config tutorial</a>

What it means

Thrown by the Weibo user bookmarks route when `config.weibo.cookies` is not set. This route fetches the authenticated user's bookmarked (collected) posts via the private container API (`https://m.weibo.cn/api/container/getIndex`). Since bookmarks are private, only the cookie owner's own bookmarks are accessible. This is a `ConfigNotFoundError`.

Source

Thrown at lib/routes/weibo/user-bookmarks.ts:54

            target: '/user_bookmarks/:uid',
        },
    ],
    name: '用户收藏动态',
    maintainers: ['cztchoice'],
    handler,
    url: 'weibo.com/',
    description: `::: warning
此方案必须使用用户\`Cookie\`进行抓取,只可以获取本人的收藏动态

因微博 cookies 的过期与更新方案未经验证,部署一次 Cookie 的有效时长未知

微博用户 Cookie 的配置可参照部署文档
:::`,
};

async function handler(ctx) {
    if (!config.weibo.cookies) {
        throw new ConfigNotFoundError('Weibo user bookmarks is not available due to the absense of [Weibo Cookies]. Check <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config tutorial</a>');
    }

    let displayVideo = '1';
    let displayArticle = '0';
    let displayComments = '0';
    if (ctx.req.param('routeParams')) {
        if (ctx.req.param('routeParams') === '1' || ctx.req.param('routeParams') === '0') {
            displayVideo = ctx.req.param('routeParams');
        } else {
            const routeParams = querystring.parse(ctx.req.param('routeParams'));
            displayVideo = fallback(undefined, queryToBoolean(routeParams.displayVideo), true) ? '1' : '0';
            displayArticle = fallback(undefined, queryToBoolean(routeParams.displayArticle), false) ? '1' : '0';
            displayComments = fallback(undefined, queryToBoolean(routeParams.displayComments), false) ? '1' : '0';
        }
    }

    const uid = await cache.tryGet(
        'weibo:user_bookmarks:login-user',

View on GitHub (pinned to bed535e087)

Solutions

  1. Set `WEIBO_COOKIES` to a valid cookie string from a logged-in Weibo browser session.
  2. Ensure the `uid` path parameter matches the cookie owner's own UID — you can only fetch your own bookmarks.
  3. Follow the configuration tutorial in the error message link for cookie setup.
  4. If cookies expire, re-extract and redeploy them.
Defensive patterns

Strategy: validation

Validate before calling

// Ensure WEIBO_COOKIES is set AND the uid matches the cookie owner
if (!process.env.WEIBO_COOKIES) {
    throw new Error('WEIBO_COOKIES required for /weibo/user_bookmarks');
}
// The uid must be the cookie owner's own UID — bookmarks are private

Try / catch

try {
    const feed = await fetchRss('/weibo/user_bookmarks/' + uid);
} catch (e) {
    if (e.name === 'ConfigNotFoundError') {
        console.error('WEIBO_COOKIES not set. This route fetches private bookmarks.');
    }
    throw e;
}

Prevention

When it happens

Trigger: A request to `/weibo/user_bookmarks/:uid/:routeParams?` on an instance without `WEIBO_COOKIES`. The guard fires at line 53 before any API call. Note: even with cookies, the route can only fetch the bookmarks of the logged-in cookie owner, not arbitrary users.

Common situations: The `WEIBO_COOKIES` environment variable is unset; the cookie has expired (Weibo cookies have limited validity); or the user is on a public instance that doesn't support private routes.

Related errors


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