{"record":{"id":"f4b42e82ceb93d18","repo":"Mintplex-Labs/anything-llm","slug":"this-chat-has-been-disabled-by-the-administrator","errorCode":null,"errorMessage":"This chat has been disabled by the administrator - try again later.","messagePattern":"This chat has been disabled by the administrator - try again later\\.","errorType":"http","errorClass":null,"httpStatus":503,"severity":"warning","filePath":"server/utils/middleware/embedMiddleware.js","lineNumber":53,"sourceCode":"    response.sendStatus(404).end();\n    return;\n  }\n\n  response.locals.embedConfig = embed;\n  next();\n}\n\nasync function canRespond(request, response, next) {\n  try {\n    const embed = response.locals.embedConfig;\n    if (!embed) {\n      response.sendStatus(404).end();\n      return;\n    }\n\n    // Block if disabled by admin.\n    if (!embed.enabled) {\n      response.status(503).json({\n        id: uuidv4(),\n        type: \"abort\",\n        textResponse: null,\n        sources: [],\n        close: true,\n        error:\n          \"This chat has been disabled by the administrator - try again later.\",\n      });\n      return;\n    }\n\n    // Check if requester hostname is in the valid allowlist of domains.\n    const host = request.headers.origin ?? \"\";\n    const allowedHosts = EmbedConfig.parseAllowedHosts(embed);\n\n    // Optional hardening for when an embed with no allowlist is created.\n    // This would mean the embed will accept requests from ANY origin (parseAllowedHosts returns\n    // null). When EMBED_REQUIRE_ALLOWLIST is enabled, treat \"no allowlist\" as","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/middleware/embedMiddleware.js#L35-L71","documentation":"Embeddable-chat gate inside canRespond: if the loaded embed config has enabled=false, the request is refused with HTTP 503 and a structured abort payload ({type:'abort', close:true, error:'This chat has been disabled by the administrator - try again later.'}). The embed exists and the embedId is valid — the admin has switched this specific embed off.","triggerScenarios":"A visitor sends a message through an embedded chat widget whose config row has enabled=false; every /embed/:embedId chat request then returns the 503 abort payload.","commonSituations":"Admin disabled a leaking/expensive embed but left the script on the page; staged rollout where embeds are toggled off outside business hours; embed duplicated from a disabled template.","solutions":["Site owner: re-enable the embed in the admin UI (Embedded Chats section) so enabled=true","If you embed the widget: treat type:'abort' with close:true as terminal — hide the chat UI instead of retrying, since only an admin action clears it","If intentional maintenance: leave it and surface a 'try again later' notice"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// widget: probe once on load instead of discovering on first message\nconst probe = await fetch(`${embedBase}/${embedId}`);\nif (probe.status === 503) mountDisabledNotice();","typeGuard":null,"tryCatchPattern":"if (res.status === 503) {\n  const data = await res.json();\n  if (data.type === 'abort' && data.close) showNotice(data.error); // terminal — stop sending\n}","preventionTips":["Handle type:'abort' + close:true as terminal in the widget protocol","Show the returned error string to visitors instead of retry loops","Keep an ops note of which embeds are toggled enabled/disabled"],"tags":["embed","anythingllm","http-503","feature-flag","widget"],"backgroundTag":"feature-flag-disabled","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"}