{"record":{"id":"c312f98b362c00c1","repo":"Mintplex-Labs/anything-llm","slug":"failed-to-sync-youtube-video-transcript-reason","errorCode":null,"errorMessage":"Failed to sync YouTube video transcript. ${reason}","messagePattern":"Failed to sync YouTube video transcript\\. (.+?)","errorType":"exception","errorClass":"Error","httpStatus":200,"severity":"error","filePath":"collector/extensions/resync/index.js","lineNumber":40,"sourceCode":"\n/**\n * Fetches the content of a YouTube link. Returns the content as a text string of the video in question.\n * We offer this as there may be some videos where a transcription could be manually edited after initial scraping\n * but in general - transcriptions often never change.\n * @param {object} data - metadata from document (eg: link)\n * @param {import(\"../../middleware/setDataSigner\").ResponseWithSigner} response\n */\nasync function resyncYouTube({ link }, response) {\n  if (!link) throw new Error(\"Invalid link provided\");\n  try {\n    const {\n      fetchVideoTranscriptContent,\n    } = require(\"../../utils/extensions/YoutubeTranscript\");\n    const { success, reason, content } = await fetchVideoTranscriptContent({\n      url: link,\n    });\n    if (!success)\n      throw new Error(`Failed to sync YouTube video transcript. ${reason}`);\n    response.status(200).json({ success, content });\n  } catch (e) {\n    console.error(e);\n    response.status(200).json({\n      success: false,\n      content: null,\n    });\n  }\n}\n\n/**\n * Fetches the content of a specific confluence page via its chunkSource.\n * Returns the content as a text string of the page in question and only that page.\n * @param {object} data - metadata from document (eg: chunkSource)\n * @param {import(\"../../middleware/setDataSigner\").ResponseWithSigner} response\n */\nasync function resyncConfluence({ chunkSource }, response) {\n  if (!chunkSource) throw new Error(\"Invalid source property provided\");","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/collector/extensions/resync/index.js#L22-L58","documentation":"Thrown by resyncYouTube in collector/extensions/resync/index.js:40 when fetchVideoTranscriptContent({ url: link }) from collector/utils/extensions/YoutubeTranscript resolves with success:false. The interpolated `reason` carries the upstream cause (transcript unavailable, fetch error, invalid video). Handler catches and answers HTTP 200 with success:false, content:null.","triggerScenarios":"Video has no captions/subtitles; video is private, age-restricted, members-only, region-blocked, or removed; YouTube changed its inner HTML; transient network/HTTP failure from the collector to youtube.com.","commonSituations":"Re-syncing auto-generated-only videos where the auto transcript was disabled; corporate egress blocked; YouTube layout change breaks the scraper; rate limiting.","solutions":["Open the video URL in a browser from the collector host to confirm it is public and has captions.","Check `reason` in the error for the upstream detail (e.g. \"Video has no transcript\").","Retry after transient failures; for permanent caption removal, drop or re-add the document.","Make sure the collector's outbound network/DNS to youtube.com works."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await resyncYouTube({ link }, response); }\ncatch (e) {\n  if (e.message.startsWith(\"Failed to sync YouTube video transcript.\")) {\n    const upstream = e.message.replace(\"Failed to sync YouTube video transcript. \", \"\");\n    if (/no (captions|transcript)|unavailable|private/i.test(upstream)) {\n      keepExistingContent();   // do not overwrite with null\n    } else {\n      scheduleRetry();         // transient\n    }\n  }\n}","preventionTips":["On failure, prefer keeping the existing cached transcript rather than overwriting with null.","Distinguish 'no captions ever' (permanent) from network/HTTP errors (transient).","Log the upstream `reason` so caption-vs-network failures are separable."],"tags":["network","resync","youtube","transcription"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}