Skip to content

[Bug]: Visiting BiliBili channel causes HTTP 422 (NullPointerException: getChannelTabLHFactory() is null) #286

Description

@Aquarius-Situla

What happened?

What went wrong:
When navigating to any BiliBili creator's channel or space (e.g. /channel/bilibili:<mid>), the page fails to load and the backend API (/api/channel/bilibili:...) throws HTTP 422 Unprocessable Entity (or HTTP 500) caused by a NullPointerException inside PipePipeChannelService.kt.

What was expected instead:
The BiliBili channel page should load normally, showing the creator's uploaded videos, channel name, and avatar (or gracefully ignore the sort parameter without crashing if tabbed sorting is unsupported for Bilibili).

Steps to reproduce

  1. Open any self-hosted TypeType instance in a web browser.
  2. Search for any BiliBili creator (e.g. 影视飓风) or open any Bilibili video.
  3. Click on the author's avatar or channel name to navigate to their channel page.
  4. The frontend router automatically navigates to /channel/bilibili:<mid>?sort=latest (defaulting sort=latest).
  5. The channel page fails to load (shows a blank screen or error message), and the backend logs an HTTP 422 NullPointerException.

Area

Frontend (web app)

Channel

main (stable)

Anything else?

Provider: BiliBili

Backend Exception Stack Trace:

java.lang.NullPointerException: Cannot invoke "org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory.fromQuery(String, String, String)" because the return value of "org.schabi.newpipe.extractor.StreamingService.getChannelTabLHFactory()" is null
    at io.github.typetype_video.server.service.PipePipeChannelService.getChannel(PipePipeChannelService.kt)
    at io.github.typetype_video.server.routes.ChannelRoutesKt.getChannel(ChannelRoutes.kt)

Root Cause Analysis (Source Code Inspection):

  1. In the frontend TanStack router (channel_._channelId-*.js), navigating to a channel automatically passes query parameter sort=latest.
  2. In PipePipeChannelService.kt, when sort != null, the server assumes the streaming service supports tabbed channels and calls service.getChannelTabLHFactory().fromQuery(...).
  3. In BilibiliService.java (line 404):
@Override
public ListLinkHandlerFactory getChannelTabLHFactory() {
    return null; // BiliBili does not implement ChannelTab link handler factory!
}

Calling .fromQuery(...) on null throws NullPointerException.

Suggested Fix:
In PipePipeChannelService.kt, check that channelTabLHFactory is not null before invoking the tab extractor:

if (sort != null && service.channelTabLHFactory != null) {
    // Extract using tab link handler
} else {
    // Fall back to standard channel extractor
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions