DIYgod/RSSHub · warning · InvalidParameterError

Invalid type: ${type}

Error message

Invalid type: ${type}

What it means

Thrown as InvalidParameterError by the Mixcloud route when the :type path parameter (defaulting to 'uploads' or 'playlist') is not a key of TYPE_CONFIG. The valid types are uploads, reposts, favorites, listens, stream, and playlist; anything else is rejected before the GraphQL call.

Source

Thrown at lib/routes/mixcloud/index.ts:108

    }
    return `Mixcloud - ${displayName}'s ${TYPE_NAMES[type] || type}`;
}

function getPlaylistLink(username: string, type: string, playlistSlug?: string): string {
    const host = MIXCLOUD_CONFIG.host;
    if (type === 'playlist' && playlistSlug) {
        return `${host}/${username}/playlists/${playlistSlug}/`;
    }
    return `${host}/${username}/${type === 'uploads' ? '' : type + '/'}`;
}

export async function handler(ctx) {
    const username = ctx.req.param('username');
    const playlistSlug = ctx.req.param('playlist');
    const type = ctx.req.param('type') ?? (playlistSlug ? 'playlist' : 'uploads');

    if (!Object.hasOwn(TYPE_CONFIG, type)) {
        throw new InvalidParameterError(`Invalid type: ${type}`);
    }

    const { objectType, objectFields } = getObjectFields(type);

    const data = await callApi(objectType, objectFields, username, playlistSlug);

    if (!data) {
        throw new Error(`${type === 'playlist' ? 'Playlist' : 'User'} not found`);
    }

    const isPlaylist = type === 'playlist';
    const displayName = isPlaylist ? username : data.displayName;
    const description = isPlaylist ? data.description : data.biog;
    const picture = data.picture;
    const image = picture && picture.urlRoot ? `${MIXCLOUD_CONFIG.imageBaseURL}${picture.urlRoot}` : '';

    const itemsData = data[TYPE_CONFIG[type]];
    const edges = itemsData?.edges || [];

View on GitHub (pinned to bed535e087)

Solutions

  1. Use one of the valid type keys: uploads, reposts, favorites, listens, stream, or playlist (omit type entirely to default to uploads).
  2. For a playlist, also supply the playlist slug via the playlist path segment per the route definition.
  3. Check the route's description table in the source for the current mapping of labels to keys.
Defensive patterns

Strategy: validation

Validate before calling

const type = ctx.req.param('type') ?? (playlistSlug ? 'playlist' : 'uploads');
if (!Object.hasOwn(TYPE_CONFIG, type)) {
    throw new InvalidParameterError(`Invalid type '${type}'. Valid: uploads, reposts, favorites, listens, stream, playlist.`);
}

Type guard

function isMixcloudType(type: string): type is keyof typeof TYPE_CONFIG {
    return typeof type === 'string' && Object.hasOwn(TYPE_CONFIG, type);
}

Prevention

When it happens

Trigger: Caller requests /mixcloud/<username>/<type> where type is e.g. 'shows' (the old label), 'history', 'stream1', or a typo. Object.hasOwn(TYPE_CONFIG, type) is false, so it throws.

Common situations: User uses a human-readable label from the docs table (Shows/History) instead of the actual key (uploads/listens); URL copied from an outdated doc; trailing slash or case mismatch.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/5a05131931d8687b. Report an issue: GitHub.