{"record":{"id":"42bf15fc59ab1f07","repo":"gitroomhq/postiz-app","slug":"channel-not-found","errorCode":null,"errorMessage":"Channel not found","messagePattern":"Channel not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts","lineNumber":376,"sourceCode":"      return [];\n    }\n  }\n\n  async fetchPageInformation(accessToken: string, data: { id: string }) {\n    const { client, youtube } = clientAndYoutube();\n    client.setCredentials({ access_token: accessToken });\n    const youtubeClient = youtube(client);\n\n    try {\n      const response = await youtubeClient.channels.list({\n        part: ['snippet', 'contentDetails', 'statistics'],\n        id: [data.id],\n      });\n\n      const channel = response.data.items?.[0];\n\n      if (!channel) {\n        throw new Error('Channel not found');\n      }\n\n      return {\n        id: channel.id!,\n        name: channel.snippet?.title || 'Unnamed Channel',\n        access_token: accessToken,\n        picture: channel.snippet?.thumbnails?.default?.url || '',\n        username: channel.snippet?.customUrl || '',\n      };\n    } catch (error) {\n      console.error('Failed to fetch YouTube channel information:', error);\n      throw error;\n    }\n  }\n\n  async reConnect(\n    id: string,\n    requiredId: string,","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/gitroomhq/postiz-app/blob/0f1647f7491a217d43eb5ae7a480484bdf0aff3e/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts#L358-L394","documentation":"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.","triggerScenarios":"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.","commonSituations":"User deleted their YouTube channel or moved brands; Google account switched after re-auth; stale integration rows after a brand-channel migration.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const pages = await provider.pages(accessToken);\nif (!pages.some(p => p.id === data.id)) { /* prompt reconnect instead of fetching info */ }","typeGuard":"const channelExists = (items: { id?: string }[]) => items.length > 0 && typeof items[0].id === 'string';","tryCatchPattern":"catch (e) { if (e instanceof Error && e.message === 'Channel not found') { /* mark integration stale; request reconnect */ } throw e; }","preventionTips":["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"],"tags":["youtube","channel-not-found","page-information","integration-stale"],"backgroundTag":"social-page-not-found","analyzedSha":"0f1647f7491a217d43eb5ae7a480484bdf0aff3e","analyzedAt":"2026-08-27T12:09:55.020Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}