{"record":{"id":"5a05131931d8687b","repo":"DIYgod/RSSHub","slug":"invalid-type-type-5a0513","errorCode":null,"errorMessage":"Invalid type: ${type}","messagePattern":"Invalid type: (.+?)","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"warning","filePath":"lib/routes/mixcloud/index.ts","lineNumber":108,"sourceCode":"    }\n    return `Mixcloud - ${displayName}'s ${TYPE_NAMES[type] || type}`;\n}\n\nfunction getPlaylistLink(username: string, type: string, playlistSlug?: string): string {\n    const host = MIXCLOUD_CONFIG.host;\n    if (type === 'playlist' && playlistSlug) {\n        return `${host}/${username}/playlists/${playlistSlug}/`;\n    }\n    return `${host}/${username}/${type === 'uploads' ? '' : type + '/'}`;\n}\n\nexport async function handler(ctx) {\n    const username = ctx.req.param('username');\n    const playlistSlug = ctx.req.param('playlist');\n    const type = ctx.req.param('type') ?? (playlistSlug ? 'playlist' : 'uploads');\n\n    if (!Object.hasOwn(TYPE_CONFIG, type)) {\n        throw new InvalidParameterError(`Invalid type: ${type}`);\n    }\n\n    const { objectType, objectFields } = getObjectFields(type);\n\n    const data = await callApi(objectType, objectFields, username, playlistSlug);\n\n    if (!data) {\n        throw new Error(`${type === 'playlist' ? 'Playlist' : 'User'} not found`);\n    }\n\n    const isPlaylist = type === 'playlist';\n    const displayName = isPlaylist ? username : data.displayName;\n    const description = isPlaylist ? data.description : data.biog;\n    const picture = data.picture;\n    const image = picture && picture.urlRoot ? `${MIXCLOUD_CONFIG.imageBaseURL}${picture.urlRoot}` : '';\n\n    const itemsData = data[TYPE_CONFIG[type]];\n    const edges = itemsData?.edges || [];","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/mixcloud/index.ts#L90-L126","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use one of the valid type keys: uploads, reposts, favorites, listens, stream, or playlist (omit type entirely to default to uploads).","For a playlist, also supply the playlist slug via the playlist path segment per the route definition.","Check the route's description table in the source for the current mapping of labels to keys."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const type = ctx.req.param('type') ?? (playlistSlug ? 'playlist' : 'uploads');\nif (!Object.hasOwn(TYPE_CONFIG, type)) {\n    throw new InvalidParameterError(`Invalid type '${type}'. Valid: uploads, reposts, favorites, listens, stream, playlist.`);\n}","typeGuard":"function isMixcloudType(type: string): type is keyof typeof TYPE_CONFIG {\n    return typeof type === 'string' && Object.hasOwn(TYPE_CONFIG, type);\n}","tryCatchPattern":null,"preventionTips":["Expose the valid type keys (not just labels) in the route description.","Constrain type selection in any UI to the known keys.","Default sensibly (uploads) when the segment is omitted."],"tags":["invalid-parameter","validation","enum","graphql","mixcloud"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}