{"record":{"id":"66b0c224d8bbf682","repo":"Mintplex-Labs/anything-llm","slug":"the-quota-for-this-chat-has-been-reached-try-agai","errorCode":null,"errorMessage":"The quota for this chat has been reached. Try again later or contact the site owner.","messagePattern":"The quota for this chat has been reached\\. Try again later or contact the site owner\\.","errorType":"http","errorClass":null,"httpStatus":429,"severity":"warning","filePath":"server/utils/middleware/embedMiddleware.js","lineNumber":137,"sourceCode":"          ? \"Message is empty.\"\n          : `${embed.chat_mode} is not a valid mode.`,\n      });\n      return;\n    }\n\n    if (\n      !isNaN(embed.max_chats_per_day) &&\n      Number(embed.max_chats_per_day) > 0\n    ) {\n      const dailyChatCount = await EmbedChats.count({\n        embed_id: embed.id,\n        createdAt: {\n          gte: new Date(new Date() - 24 * 60 * 60 * 1000),\n        },\n      });\n\n      if (dailyChatCount >= Number(embed.max_chats_per_day)) {\n        response.status(429).json({\n          id: uuidv4(),\n          type: \"abort\",\n          textResponse: null,\n          sources: [],\n          close: true,\n          error: \"Rate limit exceeded\",\n          errorMsg:\n            \"The quota for this chat has been reached. Try again later or contact the site owner.\",\n        });\n        return;\n      }\n    }\n\n    if (\n      !isNaN(embed.max_chats_per_session) &&\n      Number(embed.max_chats_per_session) > 0\n    ) {\n      const dailySessionCount = await EmbedChats.count({","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/middleware/embedMiddleware.js#L119-L155","documentation":"The user-facing half of the same 429 daily-quota response: alongside machine-readable error 'Rate limit exceeded', the payload carries errorMsg 'The quota for this chat has been reached. Try again later or contact the site owner.' — written to be shown to end visitors of an embedded chat. The response also has type:'abort' and close:true so the widget knows the stream is over.","triggerScenarios":"Same condition as the daily quota abort (EmbedChats count in 24h >= max_chats_per_day); this string is what well-behaved widgets are expected to render to the visitor.","commonSituations":"Widget integrations that display the raw error field instead of errorMsg, leaking 'Rate limit exceeded' jargon to visitors; support tickets where site owners did not realize a quota was configured.","solutions":["In widget code, prefer errorMsg when present and fall back to error","Treat type:'abort' with close:true as terminal — do not auto-retry","Site owner: raise or clear max_chats_per_day on the embed to stop the 429s"],"exampleFix":"// before\nshowToast(data.error); // 'Rate limit exceeded' — jargon shown to visitors\n\n// after\nif (data.errorMsg) showToast(data.errorMsg); // visitor-friendly quota message\nelse if (data.error) console.warn(data.error);","handlingStrategy":"fallback","validationCode":null,"typeGuard":"const hasVisitorMessage = (payload) =>\n  typeof payload?.errorMsg === 'string' && payload.errorMsg.length > 0;","tryCatchPattern":"const data = await res.json();\nshow(data.errorMsg ?? data.error ?? 'Chat unavailable'); // prefer the visitor-facing errorMsg","preventionTips":["Render errorMsg (not error) to end users in widget UIs","Include both fields in widget telemetry so support sees machine + human text","Test the widget against a capped embed before shipping"],"tags":["embed","rate-limit","quota","ux","http-429"],"backgroundTag":"rate-limit-exceeded","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}