khoj-ai/khoj · warning · HTTPException
I'm glad you're enjoying interacting with me! You've unfortu
Error message
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? What it means
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.
Source
Thrown at src/khoj/routers/helpers.py:2370
if conversation_command not in self.restricted_commands:
return
user: KhojUser = request.user.object
subscribed = has_required_scope(request, ["premium"])
# Remove requests outside of the 24-hr time window
cutoff = django_timezone.now() - timedelta(seconds=60 * 60 * 24)
command_slug = f"{self.slug}_{conversation_command.value}"
count_requests = await UserRequests.objects.filter(
user=user, created_at__gte=cutoff, slug=command_slug
).acount()
if subscribed and count_requests >= self.subscribed_rate_limit:
logger.info(
f"Rate limit: {count_requests}/{self.subscribed_rate_limit} requests not allowed in 24 hours for subscribed user: {user}."
)
raise HTTPException(
status_code=429,
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?",
)
if not subscribed and count_requests >= self.trial_rate_limit:
logger.info(
f"Rate limit: {count_requests}/{self.trial_rate_limit} requests not allowed in 24 hours for user: {user}."
)
raise HTTPException(
status_code=429,
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?",
)
await UserRequests.objects.acreate(user=user, slug=command_slug)
return
class ApiIndexedDataLimiter:
def __init__(
self,View on GitHub (pinned to ae229ca894)
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
Defensive patterns
Strategy: fallback
Try / catch
try:
async for event in client.chat_stream(msg):
handle(event)
except HTTPException as e:
if e.status_code == 429 and 'command usage limit' in e.detail:
retry_without_command(msg) # resend as plain text
else:
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- I'm glad you're enjoying interacting with me! You've unfortu
- {common_message_prefix} But let's chat more {next_window}?
- {common_message_prefix} You can subscribe to increase your u
- Those are way too many images for me! I can handle up to {se
- Those images are way too large for me! I can handle up to {s
AI-assisted analysis of khoj-ai/khoj@ae229ca894 (2026-08-27).
Data as JSON: /api/errors/cbf4efd7dcfadd07.
Report an issue: GitHub.