{"record":{"id":"6fd0c01a00ac0b56","repo":"DIYgod/RSSHub","slug":"invalid-column-column","errorCode":null,"errorMessage":"Invalid Column: ${column}","messagePattern":"Invalid Column: (.+?)","errorType":"exception","errorClass":"InvalidParameterError","httpStatus":503,"severity":"warning","filePath":"lib/routes/tkww/index.ts","lineNumber":53,"sourceCode":"};\n\nasync function handler(ctx) {\n    const column = ctx.req.param('column') ?? 'home';\n\n    const columns = await cache.tryGet('https://www.tkww.hk/columns.json', async () => await got('https://www.tkww.hk/columns.json'), config.cache.routeExpire, false);\n\n    let metadata;\n    let scope = columns.data.data;\n    for (const segment of column.split('/')) {\n        if (typeof segment !== 'string') {\n            continue;\n        }\n        metadata = scope.find((item) => item.name === segment || item.dirname === segment);\n        scope = metadata?.children ?? [];\n    }\n\n    if (metadata === undefined) {\n        throw new InvalidParameterError(`Invalid Column: ${column}`);\n    }\n\n    const stories = await got(`https://www.tkww.hk/columns/${metadata.uuid}/tkww/app/stories.json`);\n\n    const items = await Promise.all(\n        stories.data.data.stories.map((item) =>\n            cache.tryGet(item.url, async () => {\n                item.link = item.url;\n                item.description = item.summary;\n                item.pubDate = item.publishTime;\n                item.category = [];\n                if (item.keywords) {\n                    item.category = [...item.category, ...item.keywords];\n                }\n                if (item.tags) {\n                    item.category = [...item.category, ...item.tags];\n                }\n                item.category = [...new Set(item.category)];","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/tkww/index.ts#L35-L71","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fetch https://www.tkww.hk/columns.json and locate the correct `name`/`dirname` for the desired column.","For nested columns pass every path segment separated by `/` (e.g. `china/shanghai`).","Invalidate the cached columns.json (`https://www.tkww.hk/columns.json` cache key) if the tree changed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const columns = await got('https://www.tkww.hk/columns.json').then((r) => r.data.data);\nconst 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; };\nif (!resolveColumn(userColumn)) throw new InvalidParameterError(`Unknown column — check columns.json: ${userColumn}`);","typeGuard":"const isColumnNode = (v: unknown): v is { name: string; dirname: string; uuid: string; children?: unknown[] } => typeof v === 'object' && v !== null && 'uuid' in v;","tryCatchPattern":null,"preventionTips":["Expose columns.json slugs in the route description","Invalidate the cached columns.json when the tree changes","Match both name and dirname as the route already does"],"tags":["invalid-parameter","tkww","path-resolution","validation","cache"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}