Mintplex-Labs/anything-llm · error

reason

Error message

reason

What it means

The 500 reply from POST /workspace/:slug/upload when Collector.processDocument() reports failure. processDocument POSTs to the collector's /process route with integrity headers; a non-ok response or any fetch error yields { success:false, reason }, and reason is surfaced verbatim here. Typical reasons are 'Response could not be completed' (collector non-ok/abort) and timeout - the fetch sets a 600-second headers timeout for big files.

Source

Thrown at server/endpoints/workspaces.js:151

        const processingOnline = await Collector.online();

        if (!processingOnline) {
          response
            .status(500)
            .json({
              success: false,
              error: `Document processing API is not online. Document ${originalname} will not be processed automatically.`,
            })
            .end();
          return;
        }

        const { success, reason, documents } = await Collector.processDocument(
          originalname,
          metadata
        );
        if (!success) {
          response.status(500).json({ success: false, error: reason }).end();
          return;
        }

        // When the upload is part of a folder upload, move the processed
        // documents from their default location into the target folder.
        if (!!folderName) moveProcessedDocsToFolder(documents, folderName);

        Collector.log(
          `Document ${originalname} uploaded processed and successfully. It is now available in documents.`
        );
        await Telemetry.sendTelemetry("document_uploaded");
        await EventLogs.logEvent(
          "document_uploaded",
          {
            documentName: originalname,
            ...(folderName ? { folder: folderName } : {}),
          },
          response.locals?.user?.id

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Read the exact reason in the response body and the collector's own logs for the matching stack trace.
  2. Confirm the file type is accepted - GET the collector's /accepts route (or Collector.acceptedFileTypes()) before uploading.
  3. For large documents, raise collector resources or split the file; the 600s headers timeout is the ceiling.
  4. If integrity/signature errors appear, redeploy server and collector together so their shared keys match.
Defensive patterns

Strategy: validation

Validate before calling

// Check accepted file types and size before uploading
const accepted = await (await fetch(`${COLLECTOR_ENDPOINT}/accepts`)).json(); // Collector.acceptedFileTypes()
const ext = name.split(".").pop().toLowerCase();
if (!accepted?.filetypes?.includes(ext)) throw new Error(`.${ext} files are not processable by the collector`);
if (file.size > MAX_UPLOAD_BYTES) throw new Error("File too large for the 600s processing window");

Try / catch

try {
  const res = await fetch(`/api/workspace/${slug}/upload`, { method: "POST", body: formData });
  const data = await res.json();
  if (res.status === 500 && /not online/i.test(data.error)) await startCollector();
  else if (res.status === 500) showReason(data.error); // collector 'reason' string
} catch (e) { console.error("upload failed:", e.message); }

Prevention

When it happens

Trigger: Collector accepts the connection but fails processing: unsupported/corrupt file type, file too large timing out at 600s, collector OOM/crash mid-processing, integrity header mismatch (X-Integrity/X-Payload-Signer keys out of sync between server and collector), or collector returning 5xx without a JSON body.

Common situations: Uploading an exotic or zero-byte file; OCR/parsing blowing collector memory on huge PDFs; regenerated encryption/comkey after partial redeploy so signed requests are rejected; collector version mismatch with the server's expected API.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/2889744b1346ad4e. Report an issue: GitHub.