Mintplex-Labs/anything-llm · error · Error
Document processing is unavailable. The collector service…
Error message
Document processing is unavailable. The collector service is offline.
What it means
Thrown in server/utils/telegramBot/utils/media.js when a Telegram user sends a document but the collector service (the separate Node process that parses documents) does not answer its online check (collector.online()). The document buffer has already been written to the hotdir; only parsing is refused. It is a dependency-availability error, not a document-format error.
Solutions
- Check collector logs (storage/collector/logs/ or container logs) for the crash reason and fix/restart it: docker compose restart collector.
- Verify connectivity from the server container to the collector: curl the COLLECTATOR/collector endpoint (default http://collector:8888 or http://127.0.0.1:8888/collect).
- Align COLLECTATOR env naming - confirm COLLECTOR_ENDPOINT matches the deployed collector port.
- If OOM-killed, raise memory limits for the collector container.
- Retry sending the document once the collector answers a health check.
Example fix
// before
if (!(await collector.online())) {
throw new Error('Document processing is unavailable. The collector service is offline.');
}
// after (caller-side guard + retry once at boot)
for (let i = 0; i < 5 && !(await collector.online()); i++) {
await new Promise((r) => setTimeout(r, 2000));
} Defensive patterns
Strategy: retry
Validate before calling
const { CollectorApi } = require('./server/utils/collectorApi');
const collector = new CollectorApi();
if (!(await collector.online())) {
return reply('Collector is starting up - please resend the document in a moment.');
} Try / catch
try {
const text = await processDocument(buf, name);
} catch (e) {
if (/collector service is offline/i.test(e.message)) {
await sleep(3000); // collector may still be booting
return processDocument(buf, name); // single retry
}
throw e;
} Prevention
- Add a collector health check to container orchestration (depends_on with healthcheck) so the bot only receives documents when the collector is up.
- Monitor collector logs for crash loops; the Telegram bot is usually the first caller to notice.
- Keep COLLECTOR_ENDPOINT stable across restarts and aligned with the deployment topology.
When it happens
Trigger: Telegram bot receives a file and calls processDocument -> collector.online() returns false because the collector process crashed, is still booting, or its HTTP port is unreachable from the server process.
Common situations: Collector crashed earlier (check storage/collector/logs or console output); docker deployment where the collector container is unhealthy or the COLLECTOR_ENDPOINT env points to the wrong host/port; resource exhaustion (OOM) killing the collector; sending a document immediately after server start before the collector is listening.
Related errors
- Collector API is not online, skipping document attachment…
- Document processing API is not online. Document
- URL could not be scraped and no content was found.
- An error occurred while deleting the model
- AnthropicLLM::getChatCompletion failed to communicate with…
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/1535761379d77c69.
Report an issue: GitHub.
Appendix: 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 3aec848f28)