{"record":{"id":"a3e2e679956a4f94","repo":"Mintplex-Labs/anything-llm","slug":"fetcherror","errorCode":null,"errorMessage":"fetchError","messagePattern":"fetchError","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/utils/middleware/communityHubDownloadsEnabled.js","lineNumber":64,"sourceCode":"/**\n * Fetch the bundle item from the community hub.\n * Sets `response.locals.bundleItem` and `response.locals.bundleUrl`.\n */\nasync function communityHubItem(request, response, next) {\n  const { importId } = reqBody(request);\n  if (!importId)\n    return response.status(500).json({\n      success: false,\n      error: \"Import ID is required\",\n    });\n\n  const {\n    url,\n    item,\n    error: fetchError,\n  } = await CommunityHub.getBundleItem(importId);\n  if (fetchError)\n    return response.status(500).json({\n      success: false,\n      error: fetchError,\n    });\n\n  response.locals.bundleItem = item;\n  response.locals.bundleUrl = url;\n  next();\n}\n\nmodule.exports = {\n  communityHubItem,\n  communityHubDownloadsEnabled,\n};\n","sourceCodeStart":46,"sourceCodeEnd":78,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/middleware/communityHubDownloadsEnabled.js#L46-L78","documentation":"Forwarded upstream failure from the communityHubItem middleware: it awaits CommunityHub.getBundleItem(importId) and, when the result carries an error, returns HTTP 500 with that error text verbatim. The forwarded message distinguishes an unknown/invalid importId from a connectivity failure to the AnythingLLM hub, so the exact string matters for diagnosis.","triggerScenarios":"Calling a hub import route when the instance cannot reach the hub endpoint (outbound HTTPS blocked, DNS failure, corporate proxy), when the hub returns 5xx, or when the importId does not correspond to a real item.","commonSituations":"Self-hosted instance behind an egress firewall that whitelists only LLM providers; mistyped importId; hub temporarily degraded; TLS interception proxy rejecting the hub certificate.","solutions":["Read the forwarded error text: 'not found'-style wording means bad importId, network wording means egress problem","Re-copy the importId from the hub item page and retry","Verify outbound connectivity from the container: curl -sS https://hub.anythingllm.com (or the configured hub host) and check proxy/DNS/firewall rules","Retry after a wait if the hub itself is having an outage"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-flight egress check before first hub import\nclass NotFound extends Error {}\n// nothing caller-side can fully prevent an upstream 5xx — validate id + connectivity instead:\nif (!/^[a-z0-9-]+$/i.test(importId)) throw new Error('Suspicious importId format');","typeGuard":null,"tryCatchPattern":"for (let i = 0; i < 3; i++) {\n  const res = await postImport(importId);\n  if (res.ok) break;\n  const { error } = await res.json();\n  if (/not found|invalid/i.test(String(error))) throw new Error('Bad importId — do not retry');\n  await backoff(i); // transient hub/network failure -> retry with jitter\n}","preventionTips":["Copy importIds from the hub UI, never retype them","Whitelist the hub host on the egress proxy/firewall","Distinguish not-found from network errors in the forwarded message before retrying"],"tags":["community-hub","upstream","fetch","network","anythingllm"],"backgroundTag":"upstream-request-failed","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}