{"record":{"id":"c1d4cd91accba797","repo":"DIYgod/RSSHub","slug":"the-channel-https-www-youtube-com-user-usernam","errorCode":null,"errorMessage":"The channel https://www.youtube.com/user/${username} does not exist.","messagePattern":"The channel https://www\\.youtube\\.com/user/(.+?) does not exist\\.","errorType":"validation","errorClass":"NotFoundError","httpStatus":404,"severity":"error","filePath":"lib/routes/youtube/api/google.ts","lineNumber":102,"sourceCode":"                image,\n                description,\n                playlistId,\n            };\n        });\n    }\n\n    // Get the appropriate playlist ID based on filterShorts setting\n    const playlistId = await (async () => {\n        if (userHandleData?.playlistId) {\n            const origPlaylistId = userHandleData.playlistId;\n\n            return getPlaylistWithShortsFilter(origPlaylistId, filterShorts);\n        }\n        const channelData = await getChannelWithUsername(username, 'contentDetails', cache);\n        const items = channelData.data.items;\n\n        if (!items) {\n            throw new NotFoundError(`The channel https://www.youtube.com/user/${username} does not exist.`);\n        }\n\n        const channelId = items[0].id;\n\n        return filterShorts ? getPlaylistWithShortsFilter(channelId, filterShorts) : items[0].contentDetails.relatedPlaylists.uploads;\n    })();\n\n    const playlistItems = await getPlaylistItems(playlistId, 'snippet', cache);\n    if (!playlistItems) {\n        throw new NotFoundError(\"This channel doesn't have any content.\");\n    }\n    const videoIds = playlistItems.data.items.map((item) => item.snippet.resourceId.videoId);\n    const videoDetails = await getVideos(videoIds.join(','), 'contentDetails', cache);\n    const subtitlesMap = isJsonFeed ? await getSrtAttachmentBatch(videoIds) : {};\n\n    return {\n        title: `${userHandleData?.channelName || username} - YouTube`,\n        link: username.startsWith('@') ? `https://www.youtube.com/${username}` : `https://www.youtube.com/user/${username}`,","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/youtube/api/google.ts#L84-L120","documentation":"NotFoundError thrown inside getDataByUsername (lib/routes/youtube/api/google.ts) when getChannelWithUsername(username, 'contentDetails') returns a response with no items. This branch runs only when the username is NOT an @-handle (so userHandleData is undefined); the YouTube Data API channels.list?forUsername= returns an empty items array, meaning no channel is associated with that legacy username.","triggerScenarios":"A request to /youtube/user/:username (non-handle) where the username has no channel (typo, never existed, or the channel was terminated/renamed away from a username). getChannelWithUsername calls the channels.list endpoint with forUsername; YouTube replies 200 with {items: []} or items missing.","commonSituations":"Caller passed a display name instead of a username; the channel migrated to a handle (@...) only and dropped the legacy username; the channel was terminated by YouTube; typo in the username segment.","solutions":["Verify the channel exists at https://www.youtube.com/user/<username> in a browser.","If the channel now uses an @handle, switch to the /youtube/user/@handle route (the handle branch resolves externalId differently).","If you have the UC... channel id, use /youtube/channel/:id instead.","Confirm the YouTube Data API key (YOUTUBE_KEY) is valid and not quota-exhausted — though quota errors usually surface elsewhere."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Cheap preflight: a legacy username must be a non-empty slug with no path separators\nfunction looksLikeYouTubeUsername(username: string): boolean {\n    return typeof username === 'string' && username.length > 0 && !/[\\\\/?#\\s]/.test(username) && !username.startsWith('@');\n}","typeGuard":null,"tryCatchPattern":"try {\n    return await getDataByUsername({ username, embed, filterShorts, isJsonFeed });\n} catch (e) {\n    if (e instanceof NotFoundError && /does not exist/.test(e.message)) {\n        // Suggest alternatives to the caller\n        throw new NotFoundError(`No channel for username \"${username}\". Try /youtube/user/@${username} (handle), or /youtube/channel/<UC...> if you have the channel id.`);\n    }\n    throw e;\n}","preventionTips":["Verify the channel exists at https://www.youtube.com/user/<username> before subscribing.","Prefer @handles or canonical UC... channel ids — legacy usernames are increasingly deprecated.","If a channel was renamed to a handle, switch the route to /youtube/user/@handle."],"tags":["youtube","not-found","channel","google-api"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}