DIYgod/RSSHub · warning · InvalidParameterError

Invalid Column: ${column}

Error message

Invalid Column: ${column}

What it means

InvalidParameterError thrown when the supplied `column` path cannot be resolved against the tkww.hk columns tree. The handler walks each `/`-separated segment against the nested children (matched by `name` or `dirname`); if the final `metadata` is still undefined, the column is invalid.

Source

Thrown at lib/routes/tkww/index.ts:53

};

async function handler(ctx) {
    const column = ctx.req.param('column') ?? 'home';

    const columns = await cache.tryGet('https://www.tkww.hk/columns.json', async () => await got('https://www.tkww.hk/columns.json'), config.cache.routeExpire, false);

    let metadata;
    let scope = columns.data.data;
    for (const segment of column.split('/')) {
        if (typeof segment !== 'string') {
            continue;
        }
        metadata = scope.find((item) => item.name === segment || item.dirname === segment);
        scope = metadata?.children ?? [];
    }

    if (metadata === undefined) {
        throw new InvalidParameterError(`Invalid Column: ${column}`);
    }

    const stories = await got(`https://www.tkww.hk/columns/${metadata.uuid}/tkww/app/stories.json`);

    const items = await Promise.all(
        stories.data.data.stories.map((item) =>
            cache.tryGet(item.url, async () => {
                item.link = item.url;
                item.description = item.summary;
                item.pubDate = item.publishTime;
                item.category = [];
                if (item.keywords) {
                    item.category = [...item.category, ...item.keywords];
                }
                if (item.tags) {
                    item.category = [...item.category, ...item.tags];
                }
                item.category = [...new Set(item.category)];

View on GitHub (pinned to bed535e087)

Solutions

  1. Fetch https://www.tkww.hk/columns.json and locate the correct `name`/`dirname` for the desired column.
  2. For nested columns pass every path segment separated by `/` (e.g. `china/shanghai`).
  3. Invalidate the cached columns.json (`https://www.tkww.hk/columns.json` cache key) if the tree changed.
Defensive patterns

Strategy: validation

Validate before calling

const columns = await got('https://www.tkww.hk/columns.json').then((r) => r.data.data);
const resolveColumn = (path: string) => { let scope = columns, meta; for (const seg of path.split('/')) { meta = scope.find((i) => i.name === seg || i.dirname === seg); scope = meta?.children ?? []; } return meta; };
if (!resolveColumn(userColumn)) throw new InvalidParameterError(`Unknown column — check columns.json: ${userColumn}`);

Type guard

const isColumnNode = (v: unknown): v is { name: string; dirname: string; uuid: string; children?: unknown[] } => typeof v === 'object' && v !== null && 'uuid' in v;

Prevention

When it happens

Trigger: A user requests `/tkww/some/bad/path` where `some` or `bad` does not match any item.name or item.dirname in https://www.tkww.hk/columns.json, so the loop leaves metadata undefined and line 52-53 throws.

Common situations: Typo in the column slug; user passed a display name (e.g. `香港`) for a nested path that only accepts dirname; the columns.json was restructured and the slug was renamed.

Related errors


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