DIYgod/RSSHub · warning · NotFoundError

The column ${columnParam} does not exist

Error message

The column ${columnParam} does not exist

What it means

Thrown as a `NotFoundError` (HTTP 404) when the `column` path parameter for the NWNU Academic Affairs Office route is not a key in the `COLUMNS` object. The supported columns include string keys like 'tzgg' (通知公告) and 'jwkx' (教务快讯). The column value is used to build `https://jwc.nwnu.edu.cn/${columnParam}/list.htm`.

Source

Thrown at lib/routes/nwnu/routes/department/academic-affairs.ts:28

const WEBSITE_LOGO = 'https://www.nwnu.edu.cn/_upload/tpl/02/d9/729/template729/favicon.ico';
const BASE_URL = 'https://jwc.nwnu.edu.cn/';

const COLUMNS: Record<string, { title: string; description: string }> = {
    tzgg: {
        title: '通知公告',
        description: '西北师范大学教务处通知公告',
    },
    jwkx: {
        title: '教务快讯',
        description: '西北师范大学教务快讯',
    },
};

const handler: Route['handler'] = async (ctx) => {
    const columnParam = ctx.req.param('column')!;
    if (COLUMNS[columnParam] === undefined) {
        throw new NotFoundError(`The column ${columnParam} does not exist`);
    }
    const columnTitle = COLUMNS[columnParam].title;
    const columnDescription = COLUMNS[columnParam].description;
    const columnPageUrl = `https://jwc.nwnu.edu.cn/${columnParam}/list.htm`;

    // Fetch the list page
    const { data: listResponse } = await got(columnPageUrl);
    const $ = load(listResponse);

    // Select all list items containing academic information
    const ITEM_SELECTOR = 'div.list_index > ul > li';
    const listItems = $(ITEM_SELECTOR);

    // Map through each list item to extract details
    const itemLinks = listItems.toArray().map((element) => {
        const title = $(element).find('span.f > a').text()!;
        const date = parseDate($(element).find('span.r').text()!);
        const relativeLink = $(element).find('span.f > a').attr('href')!;

View on GitHub (pinned to bed535e087)

Solutions

  1. Use only the column keys defined in COLUMNS in `lib/routes/nwnu/routes/department/academic-affairs.ts` (e.g., 'tzgg', 'jwkx').
  2. Browse `https://jwc.nwnu.edu.cn/` to find valid column path segments.
  3. Add new column entries to COLUMNS if the department added sections.
Defensive patterns

Strategy: validation

Validate before calling

// Validate column against COLUMNS keys
const validColumns = new Set(Object.keys(COLUMNS));
if (!validColumns.has(columnParam)) {
    throw new NotFoundError(
        `The column ${columnParam} does not exist. Valid columns: ${[...validColumns].join(', ')}`
    );
}

Type guard

function isValidColumn(column: string, columns: Record<string, unknown>): column is string {
    return Object.hasOwn(columns, column);
}

Prevention

When it happens

Trigger: Requesting the NWNU academic-affairs route with a column value that doesn't match any key in COLUMNS (e.g., a column name not among the predefined set like 'tzgg', 'jwkx').

Common situations: User passes an unsupported column identifier. The academic affairs website restructured its URL paths. A typo in the column name.

Related errors


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