gitroomhq/postiz-app · error · Error
Channel not found
Error message
Channel not found
What it means
fetchPageInformation calls YouTube's channels.list with the stored channel id and the response contains no items, so it throws 'Channel not found'. This runs when Postiz refreshes channel info for a connected YouTube integration.
Source
Thrown at libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts:376
return [];
}
}
async fetchPageInformation(accessToken: string, data: { id: string }) {
const { client, youtube } = clientAndYoutube();
client.setCredentials({ access_token: accessToken });
const youtubeClient = youtube(client);
try {
const response = await youtubeClient.channels.list({
part: ['snippet', 'contentDetails', 'statistics'],
id: [data.id],
});
const channel = response.data.items?.[0];
if (!channel) {
throw new Error('Channel not found');
}
return {
id: channel.id!,
name: channel.snippet?.title || 'Unnamed Channel',
access_token: accessToken,
picture: channel.snippet?.thumbnails?.default?.url || '',
username: channel.snippet?.customUrl || '',
};
} catch (error) {
console.error('Failed to fetch YouTube channel information:', error);
throw error;
}
}
async reConnect(
id: string,
requiredId: string,View on GitHub (pinned to 0f1647f749)
Solutions
- Confirm the channel still exists and the same Google account owns it
- Reconnect the YouTube channel in Postiz to refresh the token and channel id
- If the channel was migrated/rebranded, remove the old integration and add the new one
- Check Google/YouTube for any account-level restrictions on API access
Defensive patterns
Strategy: validation
Validate before calling
const pages = await provider.pages(accessToken);
if (!pages.some(p => p.id === data.id)) { /* prompt reconnect instead of fetching info */ } Type guard
const channelExists = (items: { id?: string }[]) => items.length > 0 && typeof items[0].id === 'string'; Try / catch
catch (e) { if (e instanceof Error && e.message === 'Channel not found') { /* mark integration stale; request reconnect */ } throw e; } Prevention
- Reconcile stored channel ids against pages() after every token refresh
- Reconnect YouTube when accounts or brand channels change
- Surface stale-channel errors to users early rather than at post time
When it happens
Trigger: channels.list?part=snippet&id=<id> returns empty items: the channel was deleted, the OAuth token now belongs to a different Google account, or the id is malformed/stale.
Common situations: User deleted their YouTube channel or moved brands; Google account switched after re-auth; stale integration rows after a brand-channel migration.
Related errors
- Tumblr blog not found
- Function not found
- Could not determine the video size for the YouTube upload
- The media storage did not return the requested byte range, p
AI-assisted analysis of gitroomhq/postiz-app@0f1647f749 (2026-08-27).
Data as JSON: /api/errors/42bf15fc59ab1f07.
Report an issue: GitHub.