{"record":{"id":"cbf4efd7dcfadd07","repo":"khoj-ai/khoj","slug":"i-m-glad-you-re-enjoying-interacting-with-me-you-cbf4ef","errorCode":null,"errorMessage":"I'm glad you're enjoying interacting with me! You've unfortunately exceeded your `/{conversation_command.value}` command usage limit for today. Maybe we can talk about something else for today?","messagePattern":"I'm glad you're enjoying interacting with me! You've unfortunately exceeded your `/(.+?)` command usage limit for today\\. Maybe we can talk about something else for today\\?","errorType":"http","errorClass":"HTTPException","httpStatus":429,"severity":"warning","filePath":"src/khoj/routers/helpers.py","lineNumber":2370,"sourceCode":"\n        if conversation_command not in self.restricted_commands:\n            return\n\n        user: KhojUser = request.user.object\n        subscribed = has_required_scope(request, [\"premium\"])\n\n        # Remove requests outside of the 24-hr time window\n        cutoff = django_timezone.now() - timedelta(seconds=60 * 60 * 24)\n        command_slug = f\"{self.slug}_{conversation_command.value}\"\n        count_requests = await UserRequests.objects.filter(\n            user=user, created_at__gte=cutoff, slug=command_slug\n        ).acount()\n\n        if subscribed and count_requests >= self.subscribed_rate_limit:\n            logger.info(\n                f\"Rate limit: {count_requests}/{self.subscribed_rate_limit} requests not allowed in 24 hours for subscribed user: {user}.\"\n            )\n            raise HTTPException(\n                status_code=429,\n                detail=f\"I'm glad you're enjoying interacting with me! You've unfortunately exceeded your `/{conversation_command.value}` command usage limit for today. Maybe we can talk about something else for today?\",\n            )\n        if not subscribed and count_requests >= self.trial_rate_limit:\n            logger.info(\n                f\"Rate limit: {count_requests}/{self.trial_rate_limit} requests not allowed in 24 hours for user: {user}.\"\n            )\n            raise HTTPException(\n                status_code=429,\n                detail=f\"I'm glad you're enjoying interacting with me! You've unfortunately exceeded your `/{conversation_command.value}` command usage limit for today. You can subscribe to increase your usage limit via [your settings](https://app.khoj.dev/settings) or we can talk about something else for today?\",\n            )\n        await UserRequests.objects.acreate(user=user, slug=command_slug)\n        return\n\n\nclass ApiIndexedDataLimiter:\n    def __init__(\n        self,","sourceCodeStart":2352,"sourceCodeEnd":2388,"githubUrl":"https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/src/khoj/routers/helpers.py#L2352-L2388","documentation":"A 429 raised by ConversationCommandRateLimiter.update_and_check_if_valid (invoked from the chat event_generator) when a user exceeds the daily usage limit for a specific slash-command (e.g. /image, /research). Subscribed users hit `subscribed_rate_limit`; the message names the exact command that ran out.","triggerScenarios":"Using a metered conversation command like /image or /research more than `subscribed_rate_limit` times in 24 hours as a subscribed user; the check runs during message processing inside event_generator, so it aborts mid-stream.","commonSituations":"Agents or automations invoking /image or /research repeatedly; users unaware that individual commands have their own daily quotas separate from the overall chat limit; tests exercising a command endpoint in a loop.","solutions":["Switch to a different command or plain chat for the rest of the 24h window (as the message suggests)","Reduce automation frequency for that specific command","If self-hosted, raise subscribed_rate_limit / trial_rate_limit for the command limiter","Track per-command usage client-side to warn before the cap"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    async for event in client.chat_stream(msg):\n        handle(event)\nexcept HTTPException as e:\n    if e.status_code == 429 and 'command usage limit' in e.detail:\n        retry_without_command(msg)  # resend as plain text\n    else:\n        raise","preventionTips":["Reserve metered commands (/image, /research) for when they're needed","Track per-command daily usage in your client","Fall back to plain chat when a command quota is exhausted"],"tags":["rate-limit","http-429","khoj","slash-command","daily-quota"],"backgroundTag":"http-429-rate-limit-exceeded","analyzedSha":"ae229ca894c0b80ad84664afcfdde523b5e87057","analyzedAt":"2026-08-27T03:32:41.843Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}