DIYgod/RSSHub · error · Error
${userOrError.__typename}
Error message
${userOrError.__typename} What it means
Generic Error from the Twitch live route: when the GraphQL `channelShellData.userOrError` has no `id`, the handler throws `userOrError.__typename` directly. That typename is Twitch's error discriminant (commonly `UserDoesntExist` or `InvalidUser`), so the thrown message is whatever Twitch returned.
Source
Thrown at lib/routes/twitch/live.ts:102
extensions: {
persistedQuery: {
version: 1,
sha256Hash: '0df42c4d26990ec1216d0b815c92cc4a4a806e25b352b66ac1dd91d5a1d59b80',
},
},
},
],
});
const channelShellData = response.data[0].data;
const streamMetadataData = response.data[1].data;
const realtimeStreamTagListData = response.data[2].data;
const channelRootAboutPanelData = response.data[3].data;
const { userOrError } = channelShellData;
const { user } = channelRootAboutPanelData;
if (!userOrError.id) {
throw new Error(userOrError.__typename);
}
const displayName = userOrError.displayName;
const liveItem: DataItem[] = [];
if (streamMetadataData.user.stream) {
liveItem.push({
title: streamMetadataData.user.lastBroadcast.title,
author: displayName,
category: realtimeStreamTagListData.user.stream.freeformTags.map((item) => item.name),
description: `<img style="max-width: 100%;" src="https://static-cdn.jtvnw.net/previews-ttv/live_user_${login}.jpg">`,
pubDate: parseDate(streamMetadataData.user.stream.createdAt),
guid: streamMetadataData.user.stream.id,
link: `https://www.twitch.tv/${login}`,
});
}
View on GitHub (pinned to bed535e087)
Solutions
- Verify the login exists by opening https://www.twitch.tv/{login}.
- If the channel renamed, use the new login.
- If logins are valid but the error persists, confirm the GQL persistedQuery sha256Hash is still current (Twitch rotates these).
Defensive patterns
Strategy: validation
Validate before calling
if (!userOrError?.id) { throw new InvalidParameterError(`Twitch login not found: ${userOrError?.__typename ?? 'unknown'}`); } Type guard
const isTwitchUser = (u: unknown): u is { id: string; displayName: string } => typeof u === 'object' && u !== null && typeof (u as any).id === 'string'; Try / catch
try { /* live handler */ }
catch (e) { if (e instanceof Error && /(UserDoesntExist|InvalidUser)/.test(e.message)) { /* surface 404 for the login */ } else throw e; } Prevention
- Validate the login format before the GQL call
- Track Twitch's persisted-query hash drift
- Map known __typename errors to stable HTTP statuses
When it happens
Trigger: A request to `/twitch/live/:login` where the login does not resolve to a Twitch user; Twitch's GQL response sets `userOrError.__typename` to an error type and omits `id`, triggering line 101-102.
Common situations: Typo in the login; the channel was renamed/deactivated; the persisted-query hash on the GQL call is stale and Twitch returns a different error shape.
Related errors
- Username does not exist
- Username does not exist
- No video under filter type "${filter}"
- Invalid type: ${type}
- Unsupported filter type "${filter}", please choose from { ${
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/02002f8b68e37c17.
Report an issue: GitHub.