DIYgod/RSSHub · error · NotFoundError
The channel https://www.youtube.com/user/${username} does no
Error message
The channel https://www.youtube.com/user/${username} does not exist. What it means
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.
Source
Thrown at lib/routes/youtube/api/google.ts:102
image,
description,
playlistId,
};
});
}
// Get the appropriate playlist ID based on filterShorts setting
const playlistId = await (async () => {
if (userHandleData?.playlistId) {
const origPlaylistId = userHandleData.playlistId;
return getPlaylistWithShortsFilter(origPlaylistId, filterShorts);
}
const channelData = await getChannelWithUsername(username, 'contentDetails', cache);
const items = channelData.data.items;
if (!items) {
throw new NotFoundError(`The channel https://www.youtube.com/user/${username} does not exist.`);
}
const channelId = items[0].id;
return filterShorts ? getPlaylistWithShortsFilter(channelId, filterShorts) : items[0].contentDetails.relatedPlaylists.uploads;
})();
const playlistItems = await getPlaylistItems(playlistId, 'snippet', cache);
if (!playlistItems) {
throw new NotFoundError("This channel doesn't have any content.");
}
const videoIds = playlistItems.data.items.map((item) => item.snippet.resourceId.videoId);
const videoDetails = await getVideos(videoIds.join(','), 'contentDetails', cache);
const subtitlesMap = isJsonFeed ? await getSrtAttachmentBatch(videoIds) : {};
return {
title: `${userHandleData?.channelName || username} - YouTube`,
link: username.startsWith('@') ? `https://www.youtube.com/${username}` : `https://www.youtube.com/user/${username}`,View on GitHub (pinned to bed535e087)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
// Cheap preflight: a legacy username must be a non-empty slug with no path separators
function looksLikeYouTubeUsername(username: string): boolean {
return typeof username === 'string' && username.length > 0 && !/[\\/?#\s]/.test(username) && !username.startsWith('@');
} Try / catch
try {
return await getDataByUsername({ username, embed, filterShorts, isJsonFeed });
} catch (e) {
if (e instanceof NotFoundError && /does not exist/.test(e.message)) {
// Suggest alternatives to the caller
throw new NotFoundError(`No channel for username "${username}". Try /youtube/user/@${username} (handle), or /youtube/channel/<UC...> if you have the channel id.`);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- This channel doesn't have any content.
- YouTube RSS is disabled due to the lack of <a href="https://
- YouTube RSS is disabled due to the lack of <a href="https://
- YouTube RSS is disabled due to the lack of <a href="https://
- 没有获取到数据
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/c1d4cd91accba797.
Report an issue: GitHub.