DIYgod/RSSHub · error · InvalidParameterError
不支持指定类型!
Error message
不支持指定类型!
What it means
Thrown by the DLsite campaign (discounted works) route when the `type` path parameter does not match any key in the `infos` lookup object. The valid keys are: `home`, `comic`, `soft`, `maniax`, `books`, `pro`, `girls`, `bl`. The handler does a direct property lookup (`infos[ctx.req.param('type')]`) and throws InvalidParameterError if the result is `undefined`.
Source
Thrown at lib/routes/dlsite/campaign.ts:156
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
nsfw: true,
},
name: 'Discounted Works',
maintainers: ['cssxsh'],
handler,
};
async function handler(ctx) {
const info = infos[ctx.req.param('type')];
// 判断参数是否合理
if (info === undefined) {
throw new InvalidParameterError('不支持指定类型!');
}
if (ctx.req.param('free') !== undefined) {
info.params.is_free = 1;
}
const link = setUrl(info);
const response = await got(new URL(link, host), {
method: 'GET',
});
const data = response.data;
const $ = load(data);
const title = `${info.name} | 割引中の作品`;
const description = $('meta[name="description"]').attr('content');
const list = $('tr[class]', '.n_worklist');
const item = list.toArray().map((element) => {
const title = $('.work_name', element).text();
const link = $('.work_name > a', element).attr('href');View on GitHub (pinned to bed535e087)
Solutions
- Check the valid type values against the route description table: home, comic, soft, maniax, books, pro, girls, bl.
- Ensure the type parameter is lowercase — the infos keys are all lowercase.
- Verify the route path format: /dlsite/campaign/<type> (e.g. /dlsite/campaign/home).
Example fix
// before
const info = infos[ctx.req.param('type')];
if (info === undefined) {
throw new InvalidParameterError('不支持指定类型!');
}
// after — include valid options in the error message
if (info === undefined) {
throw new InvalidParameterError(`Unsupported type '${ctx.req.param('type')}'. Valid types: ${Object.keys(infos).join(', ')}`);
} Defensive patterns
Strategy: validation
Validate before calling
// Validate the type parameter before making the request
const validTypes = ['home', 'comic', 'soft', 'maniax', 'books', 'pro', 'girls', 'bl'];
function isValidDlsiteType(type: string): boolean {
return validTypes.includes(type.toLowerCase());
}
// Usage
const type = userInput;
if (!isValidDlsiteType(type)) {
throw new Error(`Invalid type. Valid: ${validTypes.join(', ')}`);
} Type guard
function isDlsiteCampaignType(value: string): value is 'home' | 'comic' | 'soft' | 'maniax' | 'books' | 'pro' | 'girls' | 'bl' {
return ['home', 'comic', 'soft', 'maniax', 'books', 'pro', 'girls', 'bl'].includes(value);
} Try / catch
try {
const feed = await fetch(`${rsshubUrl}/dlsite/campaign/${type}`);
} catch (e) {
if (e.message.includes('不支持指定类型')) {
console.error(`Invalid type '${type}'. Use one of: home, comic, soft, maniax, books, pro, girls, bl`);
}
throw e;
} Prevention
- Always lowercase the type parameter before using it in the route URL.
- Refer to the route description table for the valid type mapping.
- If building a client, validate against the known type list before making the request.
When it happens
Trigger: Calling the route with a type value not in the infos object (e.g. `/dlsite/campaign/furry`, `/dlsite/campaign/r18`); typos in the type parameter; using an uppercase variant like `/dlsite/campaign/Home` (keys are lowercase).
Common situations: Developer copies a type name from another DLsite route or documentation that uses different naming; user enters a category that exists on the DLsite website but is not mapped in this route's `infos` object.
Related errors
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/b54098a00f0c97ee.
Report an issue: GitHub.