HIGH: Missing Error Handling in API Calls #7

Open
opened 2026-02-16 22:09:37 +02:00 by Koko210 · 0 comments
Owner

When external API calls fail (LLM, memory, TTS, STT), errors are often swallowed or cause uncaught exceptions. This leads to silent failures or bot crashes.

Where It Occurs

  • bot/utils/llm.py - LLM API calls without try/except
  • bot/utils/memory_consolidation.py - Memory consolidation API calls
  • bot/api.py - Web API endpoints without error handling
  • bot/utils/evie_tts.py - TTS API calls

Why This Is a Problem

  1. Silent Failures: Errors are logged but user gets no feedback
  2. Bot Crashes: Uncaught exceptions terminate bot
  3. Data Loss: Failed API calls may lose user messages
  4. Poor UX: Users do not know why bot is not responding

What Can Go Wrong

Scenario 1: LLM API Timeout

  1. User sends long message to bot
  2. Bot calls LLM API
  3. API times out (network issue, server overloaded)
  4. Exception is not caught
  5. Bot crashes and restarts
  6. Users message is lost

Scenario 2: TTS API Rate Limit

  1. User requests voice message
  2. Bot calls TTS API
  3. API returns 429 Too Many Requests
  4. Error is caught but not handled
  5. Bot does not retry or inform user
  6. User sees no response

Proposed Fix

Wrap all API calls in try/except with retry logic and user feedback.

Severity

HIGH - Unhandled API errors cause bot crashes and silent failures.

Files Affected

bot/utils/llm.py, bot/utils/memory_consolidation.py, bot/api.py, bot/utils/evie_tts.py

When external API calls fail (LLM, memory, TTS, STT), errors are often swallowed or cause uncaught exceptions. This leads to silent failures or bot crashes. ## Where It Occurs - bot/utils/llm.py - LLM API calls without try/except - bot/utils/memory_consolidation.py - Memory consolidation API calls - bot/api.py - Web API endpoints without error handling - bot/utils/evie_tts.py - TTS API calls ## Why This Is a Problem 1. Silent Failures: Errors are logged but user gets no feedback 2. Bot Crashes: Uncaught exceptions terminate bot 3. Data Loss: Failed API calls may lose user messages 4. Poor UX: Users do not know why bot is not responding ## What Can Go Wrong ### Scenario 1: LLM API Timeout 1. User sends long message to bot 2. Bot calls LLM API 3. API times out (network issue, server overloaded) 4. Exception is not caught 5. Bot crashes and restarts 6. Users message is lost ### Scenario 2: TTS API Rate Limit 1. User requests voice message 2. Bot calls TTS API 3. API returns 429 Too Many Requests 4. Error is caught but not handled 5. Bot does not retry or inform user 6. User sees no response ## Proposed Fix Wrap all API calls in try/except with retry logic and user feedback. ## Severity HIGH - Unhandled API errors cause bot crashes and silent failures. ## Files Affected bot/utils/llm.py, bot/utils/memory_consolidation.py, bot/api.py, bot/utils/evie_tts.py
Koko210 reopened this issue 2026-02-16 22:17:02 +02:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Koko210/miku-discord#7