{"record":{"id":"276f40d3f722d8dc","repo":"DIYgod/RSSHub","slug":"discord-rss-is-disabled-due-to-the-lack-of-authori-276f40","errorCode":null,"errorMessage":"Discord RSS is disabled due to the lack of authorization config","messagePattern":"Discord RSS is disabled due to the lack of authorization config","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/routes/discord/search.ts","lineNumber":60,"sourceCode":"\n    const params = {\n        content: parsed.get('content') ?? undefined,\n        author_id: parsed.get('author_id') ?? undefined,\n        mentions: parsed.get('mentions') ?? undefined,\n        has: validHasTypes?.length ? validHasTypes : undefined,\n        min_id: parsed.get('min_id') ?? undefined,\n        max_id: parsed.get('max_id') ?? undefined,\n        channel_id: parsed.get('channel_id') ?? undefined,\n        pinned: parsed.has('pinned') ? queryToBoolean(parsed.get('pinned')) : undefined,\n    };\n\n    return Object.fromEntries(Object.entries(params).filter(([, value]) => value !== undefined));\n};\n\nasync function handler(ctx) {\n    const { authorization } = config.discord || {};\n    if (!authorization) {\n        throw new ConfigNotFoundError('Discord RSS is disabled due to the lack of authorization config');\n    }\n\n    const { guildId } = ctx.req.param();\n    const searchParams = parseSearchParams(ctx.req.param('routeParams'));\n\n    if (!Object.keys(searchParams).length) {\n        throw new InvalidParameterError('At least one valid search parameter is required');\n    }\n\n    const [guildInfo, searchResult] = await Promise.all([getGuild(guildId, authorization), searchGuildMessages(guildId, authorization, searchParams)]);\n\n    if (!searchResult?.messages?.length) {\n        return {\n            title: `Search Results - ${guildInfo.name}`,\n            link: `${baseUrl}/channels/${guildId}`,\n            item: [],\n            allowEmpty: true,\n        };","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/discord/search.ts#L42-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set DISCORD_AUTHORIZATION environment variable with a valid Discord user token.","Follow https://docs.rsshub.app/deploy/config for Discord-specific configuration.","Verify the token is valid and not expired.","Restart RSSHub after setting the variable."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!config.discord?.authorization) {\n    throw new ConfigNotFoundError('Set DISCORD_AUTHORIZATION to use Discord search routes');\n}","typeGuard":"function hasDiscordAuth(cfg: any): cfg is { discord: { authorization: string } } {\n    return typeof cfg?.discord?.authorization === 'string' && cfg.discord.authorization.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Configure DISCORD_AUTHORIZATION before using any Discord route.","Consider extracting the config check into a shared helper used by all Discord routes.","Validate the token works by testing with a simple channel read."],"tags":["discord","configuration","authentication","config-not-found","self-hosted"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}