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 Postgraduate Affairs route is not a key in the `COLUMNS` object. The supported columns include numeric string keys like those for '学科建设' (e.g., '2703') and '学位工作' ('2704'). The column value is used to build `https://yjsy.nwnu.edu.cn/${columnParam}/list.htm`.

Source

Thrown at lib/routes/nwnu/routes/department/postgraduate.ts:48

    },
    '2702': {
        title: '培养工作',
        description: '培养工作栏目信息汇总',
    },
    '2703': {
        title: '学科建设',
        description: '研究生院学科建设信息汇总',
    },
    '2704': {
        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://yjsy.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 = '#AjaxList > ul > li.a-list';
    const listItems = $(ITEM_SELECTOR);

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

View on GitHub (pinned to bed535e087)

Solutions

  1. Use only the column IDs defined in COLUMNS in `lib/routes/nwnu/routes/department/postgraduate.ts` (e.g., '2703', '2704').
  2. Browse `https://yjsy.nwnu.edu.cn/` to find valid column path segments from navigation.
  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 postgraduate route with a column value that doesn't match any key in COLUMNS (e.g., a numeric column ID not among the predefined set).

Common situations: User passes an unsupported numeric column ID. The graduate school website restructured its column numbering. A radar rule references an outdated column.

Related errors


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