Mintplex-Labs/anything-llm · error · Error

Failed to sync Confluence page content. ${reason}

Error message

Failed to sync Confluence page content. ${reason}

What it means

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.

Source

Thrown at collector/extensions/resync/index.js:77

  try {
    // Confluence data is `payload` encrypted. So we need to expand its
    // encrypted payload back into query params so we can reFetch the page with same access token/params.
    const source = response.locals.encryptionWorker.expandPayload(chunkSource);
    const {
      fetchConfluencePage,
    } = require("../../utils/extensions/Confluence");
    const { success, reason, content } = await fetchConfluencePage({
      pageUrl: `https:${source.pathname}`, // need to add back the real protocol
      baseUrl: source.searchParams.get("baseUrl"),
      spaceKey: source.searchParams.get("spaceKey"),
      accessToken: source.searchParams.get("token"),
      username: source.searchParams.get("username"),
      cloud: source.searchParams.get("cloud") === "true",
      bypassSSL: source.searchParams.get("bypassSSL") === "true",
    });

    if (!success)
      throw new Error(`Failed to sync Confluence page content. ${reason}`);
    response.status(200).json({ success, content });
  } catch (e) {
    console.error(e);
    response.status(200).json({
      success: false,
      content: null,
    });
  }
}

/**
 * Fetches the content of a specific confluence page via its chunkSource.
 * Returns the content as a text string of the page in question and only that page.
 * @param {object} data - metadata from document (eg: chunkSource)
 * @param {import("../../middleware/setDataSigner").ResponseWithSigner} response
 */
async function resyncGithub({ chunkSource }, response) {
  if (!chunkSource) throw new Error("Invalid source property provided");

View on GitHub (pinned to 526360e320)

Solutions

  1. Inspect the appended `reason` for the upstream HTTP status.
  2. Re-scrape the Confluence space with a fresh, valid access token so a new chunkSource is written.
  3. Confirm baseUrl still resolves from the collector host and TLS is valid (or original scrape used bypassSSL=true).
  4. Verify the `cloud` flag matches the deployment (Cloud uses email:token, Server/DC uses username:token).
Defensive patterns

Strategy: try-catch

Try / catch

try { await resyncConfluence({ chunkSource }, response); }
catch (e) {
  if (e.message.startsWith("Failed to sync Confluence page content.")) {
    const upstream = e.message.replace("Failed to sync Confluence page content. ", "");
    if (/401|403|unauthorized|forbidden/i.test(upstream)) rotateConfluenceToken();
    else if (/404|not found/i.test(upstream)) markPageDeleted();
    else scheduleRetry();
  }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/7a1eca43f434e291. Report an issue: GitHub.