{"record":{"id":"2889744b1346ad4e","repo":"Mintplex-Labs/anything-llm","slug":"reason-288974","errorCode":null,"errorMessage":"reason","messagePattern":"reason","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/workspaces.js","lineNumber":151,"sourceCode":"        const processingOnline = await Collector.online();\n\n        if (!processingOnline) {\n          response\n            .status(500)\n            .json({\n              success: false,\n              error: `Document processing API is not online. Document ${originalname} will not be processed automatically.`,\n            })\n            .end();\n          return;\n        }\n\n        const { success, reason, documents } = await Collector.processDocument(\n          originalname,\n          metadata\n        );\n        if (!success) {\n          response.status(500).json({ success: false, error: reason }).end();\n          return;\n        }\n\n        // When the upload is part of a folder upload, move the processed\n        // documents from their default location into the target folder.\n        if (!!folderName) moveProcessedDocsToFolder(documents, folderName);\n\n        Collector.log(\n          `Document ${originalname} uploaded processed and successfully. It is now available in documents.`\n        );\n        await Telemetry.sendTelemetry(\"document_uploaded\");\n        await EventLogs.logEvent(\n          \"document_uploaded\",\n          {\n            documentName: originalname,\n            ...(folderName ? { folder: folderName } : {}),\n          },\n          response.locals?.user?.id","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/workspaces.js#L133-L169","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the exact reason in the response body and the collector's own logs for the matching stack trace.","Confirm the file type is accepted - GET the collector's /accepts route (or Collector.acceptedFileTypes()) before uploading.","For large documents, raise collector resources or split the file; the 600s headers timeout is the ceiling.","If integrity/signature errors appear, redeploy server and collector together so their shared keys match."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check accepted file types and size before uploading\nconst accepted = await (await fetch(`${COLLECTOR_ENDPOINT}/accepts`)).json(); // Collector.acceptedFileTypes()\nconst ext = name.split(\".\").pop().toLowerCase();\nif (!accepted?.filetypes?.includes(ext)) throw new Error(`.${ext} files are not processable by the collector`);\nif (file.size > MAX_UPLOAD_BYTES) throw new Error(\"File too large for the 600s processing window\");","typeGuard":null,"tryCatchPattern":"try {\n  const res = await fetch(`/api/workspace/${slug}/upload`, { method: \"POST\", body: formData });\n  const data = await res.json();\n  if (res.status === 500 && /not online/i.test(data.error)) await startCollector();\n  else if (res.status === 500) showReason(data.error); // collector 'reason' string\n} catch (e) { console.error(\"upload failed:\", e.message); }","preventionTips":["Filter uploads against the collector's /accepts list in the UI before POSTing.","Cap upload size and split very large documents to stay inside the 600-second processing window.","Deploy server and collector together so the X-Integrity signing keys never drift."],"tags":["collector","document-processing","upload","timeout"],"backgroundTag":"document-processing-failed","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}