DIYgod/RSSHub · error · Error

list[0].messageRenderer.text.runs[0].text

Error message

list[0].messageRenderer.text.runs[0].text

What it means

Thrown at lib/routes/youtube/community.tsx:66 when the first element of the community tab's item list is a `messageRenderer` instead of a `backstagePostThreadRenderer`. YouTube uses `messageRenderer` to display empty-state or restriction messages (e.g. 'This channel has no community posts yet', 'This channel's community tab is not available'). The error message thrown is YouTube's own rendered text from `list[0].messageRenderer.text.runs[0].text`, surfaced directly to the user.

Source

Thrown at lib/routes/youtube/community.tsx:66

    }

    const response = await ofetch(`https://www.youtube.com/${urlPath}/posts`);
    const $ = load(response);
    const ytInitialData = JSON.parse(
        $('script')
            .text()
            .match(/ytInitialData = (\{.*?\});/)?.[1] ?? '{}'
    );

    const channelMetadata = ytInitialData.metadata.channelMetadataRenderer;
    const username = channelMetadata.title;
    const communityTab = ytInitialData.contents.twoColumnBrowseResultsRenderer.tabs.find(
        (tab) => tab.tabRenderer.endpoint.commandMetadata.webCommandMetadata.url.endsWith('/posts') || tab.tabRenderer.endpoint.commandMetadata.webCommandMetadata.url.endsWith('/community')
    );
    const list = communityTab.tabRenderer.content.sectionListRenderer.contents[0].itemSectionRenderer.contents;

    if (list[0].messageRenderer) {
        throw new Error(list[0].messageRenderer.text.runs[0].text);
    }

    const items = list
        .filter((i) => i.backstagePostThreadRenderer)
        .map((item) => {
            const post = item.backstagePostThreadRenderer.post.backstagePostRenderer || item.backstagePostThreadRenderer.post.sharedPostRenderer.originalPost.backstagePostRenderer;
            const media = post.backstageAttachment?.postMultiImageRenderer?.images.map((i) => i.backstageImageRenderer.image.thumbnails.pop()) ?? [post.backstageAttachment?.backstageImageRenderer?.image.thumbnails.pop()];
            return {
                title: post.contentText.runs?.[0].text ?? '',
                description: renderCommunityDescription(post.contentText.runs, media),
                link: `https://www.youtube.com/post/${post.postId}`,
                author: post.authorText.runs[0].text,
                pubDate: parseRelativeDate(post.publishedTimeText.runs[0].text.split('(', 1)[0]),
            };
        });

    return {
        title: `${username} - Community Posts- YouTube`,

View on GitHub (pinned to bed535e087)

Solutions

  1. Open `https://www.youtube.com/{handle}/community` in a browser to verify the channel actually has community posts.
  2. Confirm the handle is correct — if using a channel ID, ensure isYouTubeChannelId recognizes it (line 46).
  3. If the channel legitimately has no posts, this error is expected behavior — there is no feed to generate.
  4. If YouTube changed the layout, update the selector logic at line 63 to find the correct tab and skip messageRenderer items.

Example fix

// before
if (list[0].messageRenderer) {
    throw new Error(list[0].messageRenderer.text.runs[0].text);
}

// after (graceful degradation instead of throwing)
const posts = list.filter((i) => i.backstagePostThreadRenderer);
if (posts.length === 0 && list[0].messageRenderer) {
    throw new Error(list[0].messageRenderer.text.runs[0].text);
}
Defensive patterns

Strategy: try-catch

Type guard

const isMessageRenderer = (item: unknown): boolean =>
    !!item && typeof item === 'object' && 'messageRenderer' in item;

Try / catch

try {
    const items = await getYoutubeCommunity(handle);
} catch (e) {
    if (e instanceof Error && /no community|not available|disabled/i.test(e.message)) {
        // channel has no community posts or they are restricted
        console.warn(`YouTube channel ${handle} has no accessible community posts`);
    }
    throw e;
}

Prevention

When it happens

Trigger: The channel genuinely has zero community posts; the channel has community posts disabled; age or region restrictions prevent showing the community tab; the handle/channel-id is valid but the community tab doesn't exist; YouTube changed the response so the first item is always a messageRenderer even when posts exist (layout change).

Common situations: User points the route at a channel that never posted to the community tab; YouTube temporarily shows a maintenance message; the handle has a typo resolving to a different/empty channel; YouTube frontend update changes the item ordering.

Related errors


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