Skip to content

Kimi/Moonshot 'Rate Limit' error masks insufficient funds, causes UI lockout #43447

Description

@superstizzle

Bug Report: Kimi/Moonshot "Rate Limit" Error Masking Insufficient Funds

Environment

  • OpenClaw Version: 2026.3.8
  • OS: macOS
  • Plugin: kimi-claw (auto-loaded)
  • Provider: Moonshot (Kimi)

Problem Summary

When Kimi/Moonshot API account balance reaches zero, the API returns a 429 Rate Limit Reached error instead of a clear billing/insufficient funds message. OpenClaw interprets this literally, triggering a cascading failure that locks the UI and prevents model switching.

Symptoms

  • UI completely frozen with repeated error: ⚠️ API rate limit reached. Please try again later.
  • Cannot send messages in chat
  • Cannot switch models via chat commands (model=...)
  • Background slug-gen task infinitely retries, spamming terminal
  • Session locked to broken provider

Root Cause

  1. Error Misclassification: Moonshot API returns 429 for billing issues, not actual rate limiting
  2. Infinite Retry Loop: slug-gen background task keeps hitting API on failure
  3. Command Routing Trap: Model switch commands route through the failing provider

Reproduction Steps

  1. Exhaust Kimi/Moonshot API credits
  2. Attempt any chat message or command
  3. Observe 429 error loop
  4. Try to switch models via chat — fails

Expected Behavior

  • Clear error: "Insufficient API credits" or "Billing issue"
  • Graceful degradation: pause background tasks after N failures
  • Emergency bypass: allow model switching even when current provider is down

Actual Behavior

  • Misleading "rate limit" error
  • Infinite retry loop
  • Complete UI lockout

Workaround

Reload funds into Kimi account, or force model switch via control UI dropdown (bypasses chat parser).

Proposed Fixes

1. Better Error Parsing (kimi-claw)

Parse Moonshot error responses for billing-specific codes/messages and surface accurate error to user.

2. Failsafe for Background Tasks

slug-gen retry policy:
- Max 3 attempts
- Exponential backoff
- After max retries: pause + notify, don't loop

3. Emergency Model Override

Route /model commands through control layer, not through the active AI provider. Critical for provider outages.

Impact

  • Severity: High — complete functionality loss
  • User Experience: Hours of confusion troubleshooting "rate limits"
  • Frequency: Any user with auto-reload disabled or payment issues

Reported by: Coach O via Clawd

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions