Mintplex-Labs/anything-llm · error · Error

Document processing is unavailable. The collector service is

Error message

Document processing is unavailable. The collector service is offline.

What it means

Thrown by parseDocumentFromBuffer() when collector.online() resolves false before attempting a parse. The collector is a separate process/container that runs document parsing (PDF/DOCX/etc.); if it is not reachable, parsing cannot proceed and the error is raised early rather than producing a confusing parse failure. The document buffer has already been written to the hotdir.

Source

Thrown at server/utils/telegramBot/utils/media.js:88

 * @param {Buffer} documentBuffer
 * @param {string} originalFilename - The original filename with extension
 * @returns {Promise<{text: string, filename: string}>}
 */
async function documentToText(documentBuffer, originalFilename) {
  const fs = require("fs");
  const path = require("path");
  const { CollectorApi } = require("../../collectorApi");
  const { hotdirPath } = require("../../files");

  if (!fs.existsSync(hotdirPath)) fs.mkdirSync(hotdirPath, { recursive: true });

  const sanitizedName = originalFilename.replace(/[^a-zA-Z0-9._-]/g, "_");
  const filename = `telegram-doc-${Date.now()}-${sanitizedName}`;
  fs.writeFileSync(path.join(hotdirPath, filename), documentBuffer);

  const collector = new CollectorApi();
  if (!(await collector.online())) {
    throw new Error(
      "Document processing is unavailable. The collector service is offline."
    );
  }

  const result = await collector.parseDocument(filename);
  if (!result?.success || !result.documents?.length) {
    throw new Error(
      result?.reason || `Failed to parse document: ${originalFilename}`
    );
  }

  const text = result.documents.map((doc) => doc.pageContent).join("\n\n");
  return { text, filename: originalFilename };
}

/**
 * Download the largest photo from a Telegram photo array and return
 * it as an attachment object compatible with the LLM chat pipeline.

View on GitHub (pinned to 526360e320)

Solutions

  1. Check that the collector service is running: `docker compose ps` / `docker logs collector`.
  2. Verify the collector connection config (host/port or socket path) matches between server and collector.
  3. Wait for collector healthcheck to pass before routing document requests.
  4. Add a readiness probe so the server declines document uploads until the collector is online.

Example fix

// before
const result = await collector.parseDocument(filename);

// after
if (!(await collector.online()))
  throw new Error('Document processing is unavailable. The collector service is offline.');
const result = await collector.parseDocument(filename);
Defensive patterns

Strategy: validation

Validate before calling

if (!(await collector.online()))
  throw new Error('Document processing is unavailable. The collector service is offline.');

Try / catch

try {
  const { text } = await parseDocumentFromBuffer(buffer, name);
} catch (e) {
  if (e.message.includes('collector service is offline'))
    return ctx.reply('Document processing is temporarily unavailable.');
  throw e;
}

Prevention

When it happens

Trigger: The collector container/process is down, restarting, or unreachable on its socket/port. A document upload via Telegram while the collector is unhealthy. First boot before the collector finished starting.

Common situations: Collector container crashed or OOM-killed; docker-compose missing or mis-linked the collector service; port/socket mismatch between server and collector after a config change; collector still booting during a request burst.

Related errors


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