DIYgod/RSSHub · warning · Error
${type} is not supported
Error message
${type} is not supported What it means
Generic Error thrown when the `type` path parameter of /binance/announcement/:type/:lang? does not resolve to a key in TYPE_CATALOG_ID_MAP (the fixed allow-list of 8 Binance announcement categories). It guards the catalogId lookup so an unmapped slug never produces a malformed API call.
Source
Thrown at lib/routes/binance/announcement.ts:72
const pageSize = Number.isNaN(limit) || limit <= 0 ? 20 : limit;
let type = rawType;
let language = normalizeLanguage(rawLang);
if (!rawLang && rawType && isLanguageCode(rawType)) {
language = normalizeLanguage(rawType);
type = undefined;
}
if (type === 'all') {
type = undefined;
}
let catalogId: number | undefined;
if (type) {
const mappedCatalogId = TYPE_CATALOG_ID_MAP[type];
if (!mappedCatalogId) {
throw new Error(`${type} is not supported`);
}
catalogId = mappedCatalogId;
}
const pageUrl = `${baseUrl}/${language}/messages/v2/group/announcement`;
const listUrl = new URL(`${baseUrl}/bapi/apex/v1/public/apex/cms/article/list/query`);
listUrl.searchParams.set('type', '1');
listUrl.searchParams.set('pageNo', '1');
listUrl.searchParams.set('pageSize', String(pageSize));
if (catalogId) {
listUrl.searchParams.set('catalogId', String(catalogId));
}
const headers = {
Referer: pageUrl,
'Accept-Language': language,
'User-Agent': config.trueUA,
lang: language,View on GitHub (pinned to bed535e087)
Solutions
- Use a slug from TYPE_CATALOG_ID_MAP: new-cryptocurrency-listing, latest-binance-news, latest-activities, new-fiat-listings, api-updates, crypto-airdrop, wallet-maintenance-updates, delisting.
- Use 'all' (or omit type) to fetch every category without a catalogId filter.
- If the category genuinely exists on Binance, add its slug and catalogId to TYPE_CATALOG_ID_MAP and submit a PR.
Example fix
// before
throw new Error(`${type} is not supported`);
// after (list the valid slugs in the message)
const valid = Object.keys(TYPE_CATALOG_ID_MAP).join(', ');
throw new Error(`${type} is not supported. Valid types: all, ${valid}`); Defensive patterns
Strategy: validation
Validate before calling
const VALID_TYPES = new Set(['all', ...Object.keys(TYPE_CATALOG_ID_MAP)]);
if (type && !VALID_TYPES.has(type)) {
throw new Error(`${type} is not supported. Valid: ${[...VALID_TYPES].join(', ')}`);
} Type guard
const isSupportedType = (t: string | undefined): boolean =>
!t || t === 'all' || Object.hasOwn(TYPE_CATALOG_ID_MAP, t); Prevention
- Keep the route's parameter description in sync with TYPE_CATALOG_ID_MAP keys.
- When Binance renames a category, add an alias mapping rather than leaving a dead slug.
When it happens
Trigger: A caller passes a type slug not present in TYPE_CATALOG_ID_MAP (e.g. a typo or a category Binance renamed), and the value is not 'all' and not detected as a language code. The mappedCatalogId lookup returns undefined and the guard fires.
Common situations: Typing the category slug incorrectly (e.g. 'new-listing' vs 'new-cryptocurrency-listing'); Binance adding a new category whose slug is not yet mapped; using an old documentation example whose slug was renamed.
Related errors
- Invalid type
- Invalid category
- Unsupported filter type "${filter}", please choose from { ${
- Bad timeRange range. See <a href="https://docs.rsshub.app/ro
- This category does not exist. Please refer to the documentat
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/42257d6df04473e8.
Report an issue: GitHub.