DIYgod/RSSHub · warning · InvalidParameterError
Invalid column
Error message
Invalid column
What it means
Thrown by the Caixin category route when the `column` path parameter fails `isValidHost()`. Column is interpolated into `https://${column}.caixin.com/${category}` as a subdomain, so it must be a valid DNS label. Correctly uses `InvalidParameterError`. Note: the URL string is built before the validation check, but the fetch happens after, so this is safe.
Source
Thrown at lib/routes/caixin/category.ts:53
以金融板块为例的 category 列表:(其余 column 以类似方式寻找)
| 监管 | 银行 | 证券基金 | 信托保险 | 投资 | 创新 | 市场 |
| ---------- | ---- | -------- | ---------------- | ---------- | ---------- | ------ |
| regulation | bank | stock | insurance\\_trust | investment | innovation | market |
Category 列表:
| 封面报道 | 开卷 | 社论 | 时事 | 编辑寄语 | 经济 | 金融 | 商业 | 环境与科技 | 民生 | 副刊 |
| ---------- | ----- | --------- | ---------------- | ------------ | ------- | ------- | -------- | ----------------------- | ------- | ------ |
| coverstory | first | editorial | current\\_affairs | editor\\_desk | economy | finance | business | environment\\_technology | cwcivil | column |`,
};
async function handler(ctx) {
const category = ctx.req.param('category');
const column = ctx.req.param('column');
const url = `https://${column}.caixin.com/${category}`;
if (!isValidHost(column)) {
throw new InvalidParameterError('Invalid column');
}
const response = await got(url);
const $ = load(response.data);
const title = $('head title').text();
const entity = JSON.parse(
$('script')
.text()
.match(/var entity = (\{.*?\})/)![1]
);
const {
data: { datas: data },
} = await got('https://gateway.caixin.com/api/extapi/homeInterface.jsp', {
searchParams: {
subject: entity.id,
type: 0,View on GitHub (pinned to bed535e087)
Solutions
- Use a documented column slug exactly (e.g. `coverstory`, `economy`).
- Keep column as a bare DNS-safe label; do not include protocol, dots, or paths.
- If you maintain the route, consider validating `category` too — only `column` is checked today.
Example fix
// before /caixin/https://economy.caixin.com/finance // after /caixin/economy/finance
Defensive patterns
Strategy: validation
Validate before calling
import { isValidHost } from '@/utils/valid-host';
const VALID_COLUMNS = ['coverstory','first','editorial','current_affairs','editor_desk','economy','finance','business','environment_technology','cwcivil','column'];
if (!isValidHost(column) || !VALID_COLUMNS.includes(column)) {
throw new Error(`Invalid column '${column}'`);
} Type guard
function isCaixinColumn(v: string): boolean {
return /^[a-z0-9_-]+$/.test(v);
} Prevention
- Keep column as a bare DNS-safe label.
- Maintainers: validate `category` too, not just `column`, for defence in depth.
- Mind the parameter order: `/caixin/<column>/<category>`.
When it happens
Trigger: Calling `/caixin/<column>/<category>` with a column containing invalid hostname characters, dots, slashes, or empty string. Valid columns from the docs table include coverstory, first, editorial, current_affairs, editor_desk, economy, finance, business, environment_technology, cwcivil, column.
Common situations: Confusing `column` and `category` order in the URL, or pasting a full URL as the column.
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/8c4ff3eb790dc256.
Report an issue: GitHub.