DIYgod/RSSHub · error · ConfigNotFoundError

Email Inbox RSS is disabled due to the lack of <a href="http

Error message

Email Inbox RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/#route-specific-configurations">relevant config</a>

What it means

Thrown by the Email IMAP handler (lib/routes/mail/imap.ts:35) as a `ConfigNotFoundError` when any of `username`, `password`, `host`, or `port` is missing on the resolved `mailConfig`. The per-account config is read from `config.email.config[<email with .@ -> _>]` as a query-string blob; if that entry is absent or incomplete the handler aborts.

Source

Thrown at lib/routes/mail/imap.ts:35

        folder: 'Inbox name, `INBOX` by default',
    },
    description: 'Only support IMAP protocol, email password and other settings refer to [Route-specific Configurations](https://docs.rsshub.app/deploy/config#route-specific-configurations)',
    name: 'Inbox',
    maintainers: ['kt286'],
    handler,
};

async function handler(ctx) {
    const { email, folder = 'INBOX' } = ctx.req.param();
    const { limit = 10 } = ctx.req.query();
    const mailConfig: { username: string; port: number | string; password?: string; host?: string } = {
        username: email,
        port: 993,
        ...Object.fromEntries(new URLSearchParams(config.email.config[email.replaceAll(/[.@]/g, '_')])),
    };

    if (!mailConfig.username || !mailConfig.password || !mailConfig.host || !mailConfig.port) {
        throw new ConfigNotFoundError('Email Inbox RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/#route-specific-configurations">relevant config</a>');
    }

    const client = new ImapFlow({
        host: mailConfig.host,
        port: Number.parseInt(String(mailConfig.port)),
        secure: true,
        auth: {
            user: mailConfig.username,
            pass: mailConfig.password,
        },
        proxy: config.proxyUri, // Note: socks5h is not supported
        logger: {
            debug: (log) => logger.debug(log.msg),
            info: (log) => logger.info(log.msg),
            warn: (log) => logger.warn(log.msg),
            error: (log) => logger.error(log?.msg),
        },
    });

View on GitHub (pinned to bed535e087)

Solutions

  1. Set `EMAIL_CONFIG_<email_with_dot_at_as_underscore>=host=imap.example.com&port=993&password=...` (query-string form) in the RSSHub environment.
  2. Ensure the sanitized key exactly matches the requested email with `.` and `@` replaced by `_`.
  3. Restart RSSHub after editing config.

Example fix

// before: no config for rss@rsshub.app
// after (env):
EMAIL_CONFIG_rss_rsshub_app=host=imap.rsshub.app&port=993&password=secret
Defensive patterns

Strategy: validation

Validate before calling

function mailConfigComplete(c: { username?: string; password?: string; host?: string; port?: number | string }): boolean {
    return Boolean(c.username && c.password && c.host && c.port);
}

Type guard

interface MailConfig { username: string; password: string; host: string; port: number | string }
function isCompleteMailConfig(c: unknown): c is MailConfig {
    return typeof c === 'object' && c !== null && typeof (c as MailConfig).username === 'string' && typeof (c as MailConfig).password === 'string' && typeof (c as MailConfig).host === 'string' && (c as MailConfig).port != null;
}

Try / catch

import ConfigNotFoundError from '@/errors/types/config-not-found';
try {
    await fetchImapInbox(email);
} catch (e) {
    if (e instanceof ConfigNotFoundError && /Email Inbox RSS is disabled/.test(e.message)) {
        return { disabled: true, reason: `No EMAIL_CONFIG entry for '${email}'` };
    }
    throw e;
}

Prevention

When it happens

Trigger: Requesting `/mail/imap/<email>/...` for an account not present in `EMAIL_CONFIG_<sanitized>`; config string missing `host`/`password`; env var naming mismatch (the sanitized email key must match `email.replaceAll(/[.@]/g, '_')`).

Common situations: Fresh install with no email config; adding a new account without the matching env entry; typos in the sanitized key (e.g. forgetting to replace `@` and `.` with `_`).

Related errors


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