{"record":{"id":"7a1eca43f434e291","repo":"Mintplex-Labs/anything-llm","slug":"failed-to-sync-confluence-page-content-reason","errorCode":null,"errorMessage":"Failed to sync Confluence page content. ${reason}","messagePattern":"Failed to sync Confluence page content\\. (.+?)","errorType":"exception","errorClass":"Error","httpStatus":200,"severity":"error","filePath":"collector/extensions/resync/index.js","lineNumber":77,"sourceCode":"  try {\n    // Confluence data is `payload` encrypted. So we need to expand its\n    // encrypted payload back into query params so we can reFetch the page with same access token/params.\n    const source = response.locals.encryptionWorker.expandPayload(chunkSource);\n    const {\n      fetchConfluencePage,\n    } = require(\"../../utils/extensions/Confluence\");\n    const { success, reason, content } = await fetchConfluencePage({\n      pageUrl: `https:${source.pathname}`, // need to add back the real protocol\n      baseUrl: source.searchParams.get(\"baseUrl\"),\n      spaceKey: source.searchParams.get(\"spaceKey\"),\n      accessToken: source.searchParams.get(\"token\"),\n      username: source.searchParams.get(\"username\"),\n      cloud: source.searchParams.get(\"cloud\") === \"true\",\n      bypassSSL: source.searchParams.get(\"bypassSSL\") === \"true\",\n    });\n\n    if (!success)\n      throw new Error(`Failed to sync Confluence page content. ${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 resyncGithub({ chunkSource }, response) {\n  if (!chunkSource) throw new Error(\"Invalid source property provided\");","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/collector/extensions/resync/index.js#L59-L95","documentation":"Thrown by resyncConfluence in collector/extensions/resync/index.js:77 when fetchConfluencePage(...) from collector/utils/extensions/Confluence resolves with success:false. The arguments come from decrypting chunkSource via response.locals.encryptionWorker.expandPayload — baseUrl, spaceKey, accessToken, username, cloud, bypassSSL. The interpolated `reason` is the upstream cause. Handler catches and answers HTTP 200 with success:false, content:null.","triggerScenarios":"Confluence access token expired or was revoked; user no longer has page permission; page/space deleted or moved; baseUrl changed; self-hosted Confluence SSL cert invalid (bypassSSL was false); cloud flag mismatch (Cloud vs Server/DC).","commonSituations":"PAT/ API token rotated since original scrape; Confluence Cloud→Server migration flipped `cloud`; corporate proxy blocks the collector; page now restricted to a group the service account is not in.","solutions":["Inspect the appended `reason` for the upstream HTTP status.","Re-scrape the Confluence space with a fresh, valid access token so a new chunkSource is written.","Confirm baseUrl still resolves from the collector host and TLS is valid (or original scrape used bypassSSL=true).","Verify the `cloud` flag matches the deployment (Cloud uses email:token, Server/DC uses username:token)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await resyncConfluence({ chunkSource }, response); }\ncatch (e) {\n  if (e.message.startsWith(\"Failed to sync Confluence page content.\")) {\n    const upstream = e.message.replace(\"Failed to sync Confluence page content. \", \"\");\n    if (/401|403|unauthorized|forbidden/i.test(upstream)) rotateConfluenceToken();\n    else if (/404|not found/i.test(upstream)) markPageDeleted();\n    else scheduleRetry();\n  }\n}","preventionTips":["Rotate Confluence tokens by re-scraping (writes a fresh chunkSource) rather than editing the payload.","Verify the `cloud` flag matches the deployment when re-scraping.","Check TLS validity for self-hosted Confluence before relying on bypassSSL."],"tags":["auth","network","resync","confluence"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}