DIYgod/RSSHub · error · ConfigNotFoundError

Discord RSS is disabled due to the lack of authorization con

Error message

Discord RSS is disabled due to the lack of authorization config

What it means

The Discord search route requires config.discord.authorization, same as other Discord routes. The handler destructures authorization from config.discord || {}, and if falsy, throws ConfigNotFoundError. This is the identical guard pattern as errors 173 and 174 but in the search-specific handler.

Source

Thrown at lib/routes/discord/search.ts:60

    const params = {
        content: parsed.get('content') ?? undefined,
        author_id: parsed.get('author_id') ?? undefined,
        mentions: parsed.get('mentions') ?? undefined,
        has: validHasTypes?.length ? validHasTypes : undefined,
        min_id: parsed.get('min_id') ?? undefined,
        max_id: parsed.get('max_id') ?? undefined,
        channel_id: parsed.get('channel_id') ?? undefined,
        pinned: parsed.has('pinned') ? queryToBoolean(parsed.get('pinned')) : undefined,
    };

    return Object.fromEntries(Object.entries(params).filter(([, value]) => value !== undefined));
};

async function handler(ctx) {
    const { authorization } = config.discord || {};
    if (!authorization) {
        throw new ConfigNotFoundError('Discord RSS is disabled due to the lack of authorization config');
    }

    const { guildId } = ctx.req.param();
    const searchParams = parseSearchParams(ctx.req.param('routeParams'));

    if (!Object.keys(searchParams).length) {
        throw new InvalidParameterError('At least one valid search parameter is required');
    }

    const [guildInfo, searchResult] = await Promise.all([getGuild(guildId, authorization), searchGuildMessages(guildId, authorization, searchParams)]);

    if (!searchResult?.messages?.length) {
        return {
            title: `Search Results - ${guildInfo.name}`,
            link: `${baseUrl}/channels/${guildId}`,
            item: [],
            allowEmpty: true,
        };

View on GitHub (pinned to bed535e087)

Solutions

  1. Set DISCORD_AUTHORIZATION environment variable with a valid Discord user token.
  2. Follow https://docs.rsshub.app/deploy/config for Discord-specific configuration.
  3. Verify the token is valid and not expired.
  4. Restart RSSHub after setting the variable.
Defensive patterns

Strategy: validation

Validate before calling

if (!config.discord?.authorization) {
    throw new ConfigNotFoundError('Set DISCORD_AUTHORIZATION to use Discord search routes');
}

Type guard

function hasDiscordAuth(cfg: any): cfg is { discord: { authorization: string } } {
    return typeof cfg?.discord?.authorization === 'string' && cfg.discord.authorization.length > 0;
}

Prevention

When it happens

Trigger: config.discord is undefined or config.discord.authorization is falsy. The handler exits before parsing search parameters or calling the Discord search API. This is purely a deployment configuration check.

Common situations: Same as 173/174: DISCORD_AUTHORIZATION not set in the deployment environment; the env var name is incorrect; the config module fails to load the variable; fresh deployment without Discord configuration.

Related errors


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