DIYgod/RSSHub · warning · InvalidParameterError
Invalid column
Error message
Invalid column
What it means
Thrown by the Caixin blog route when `column` fails `isValidHost()`. The column becomes the subdomain (`https://${column}.blog.caixin.com`), so it must be a syntactically valid hostname label. Correctly uses `InvalidParameterError`. Note the `column` parameter is optional (`/blog/:column?`); when omitted the handler takes a different branch.
Source
Thrown at lib/routes/caixin/blog.ts:36
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
name: '用户博客',
maintainers: ['Maecenas'],
handler,
description: '通过提取文章全文,以提供比官方源更佳的阅读体验.',
};
async function handler(ctx) {
const column = ctx.req.param('column');
const { limit = 20 } = ctx.req.query();
if (column) {
if (!isValidHost(column)) {
throw new InvalidParameterError('Invalid column');
}
const link = `https://${column}.blog.caixin.com`;
const { data: response } = await got(link);
const $ = load(response);
const user = $('div.indexMainConri > script[type="text/javascript"]')
.text()
.slice('window.user = '.length + 1)
.split(';', 1)[0]
.replaceAll(/\s/g, '');
const authorId = user.match(/id:"(\d+)"/)![1];
const authorName = user.match(/name:"(.*?)"/)![1];
const avatar = user.match(/avatar:"(.*?)"/)![1];
const introduce = user.match(/introduce:"(.*?)"/)![1];
const {
data: { data },
} = await got('https://blog.caixin.com/blog-api/post/posts', {
searchParams: {View on GitHub (pinned to bed535e087)
Solutions
- Pass only the blog slug, e.g. `/caixin/blog/zhangwuchang`.
- Strip protocol, `.blog.caixin.com`, and any path before submitting.
- If omitting entirely, use `/caixin/blog` to hit the no-column branch.
Example fix
// before /caixin/blog/https://zhangwuchang.blog.caixin.com // after /caixin/blog/zhangwuchang
Defensive patterns
Strategy: type-guard
Validate before calling
import { isValidHost } from '@/utils/valid-host';
if (column && !isValidHost(column)) {
// reject before building the URL
throw new Error(`'${column}' is not a valid blog slug / hostname label`);
} Type guard
function isBlogSlug(v: string): boolean {
// DNS-label-ish: lowercase, no protocol, no dots, no slashes
return /^[a-z0-9-]+$/.test(v);
} Prevention
- Pass only the bare slug, never the full URL.
- Strip `https://`, the `.blog.caixin.com` suffix, and any path before submitting.
- Omit the param entirely to hit the default blog listing branch.
When it happens
Trigger: Supplying a column containing characters illegal in a DNS label (e.g. spaces, slashes, uppercase with mixed punctuation, `..`, URL-encoded `%2F`), or an empty string after the colon.
Common situations: Pasting the full blog URL instead of just the slug (e.g. `https://zhangwuchang.blog.caixin.com` instead of `zhangwuchang`), or including a trailing path segment.
Related errors
- Invalid column
- Invalid type parameter
- unknown site: ${site}
- Invalid type parameter
- Invalid category: ${category}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/8bef8200dbcee7c8.
Report an issue: GitHub.