Menu

Cosmo Wiki

Troubleshooting

Operational troubleshooting for CPU, events, database, LLM, wakeword, and TTS.

High Idle CPU

If idle CPU is greater than 20%, it is typically Vosk AcceptWaveform() in a continuous loop.

wakeword:
  energy_threshold: 300
  idle_sleep: 0.05
audio:
  chunk_size: 512
ps aux | grep -i cosmo | grep -i python
top -p $PID
py-spy top --pid $PID

Event Queue Growing / Listener Timeouts

curl http://127.0.0.1:8765/api/status/compact | jq .event_bus
tail -f cosmo/data/logs/cosmo.log | grep "listener_timeout"

If legitimate processing is slow due to hardware limitations, consider increasing the listener timeout, currently set to 30 seconds.

Memory Growing / SQLite Lock Contention

sqlite3 cosmo/data/database/cosmo.db "SELECT COUNT(*) FROM memories; SELECT COUNT(*) FROM conversations; SELECT COUNT(*) FROM events;"

sqlite3 cosmo/data/database/cosmo.db "DELETE FROM memories WHERE created_at < datetime('now', '-30 days');"
sqlite3 cosmo/data/database/cosmo.db "VACUUM;"

Wakeword Not Detecting

ls -la cosmo/models/vosk/vosk-model-small-pt-0.3/
wakeword:
  words:
    - cosmo
    - zenith
from cosmo.audio.stt.stt_engine import stt_engine
stt_engine.transcribe("path/to/audio.wav")

Wakeword Delayed After First Interaction

Typical cause: stream backlog or microphone ownership conflict. The current solution is exclusive microphone ownership by runtime mode: wakeword owns the PyAudio stream only during idle, closes it in non-idle modes, and closes it again after detection before listening/STT.

tail -f cosmo/data/logs/cosmo.log | grep -E "Stream wakeword|Wakeword"

STT Cuts Beginning of Phrase

Avoid draining or clearing the microphone buffer between the sim? prompt and speech capture. During listening, STT capture should own the microphone directly.

Camera LED Always On

This is expected when persistent camera session is active. auto_capture every 10 seconds does not mean a video stream FPS; it means periodic processing and snapshot capture while the camera session may remain open.

Black Frame or Very Dark Frame

If the camera works and the image is genuinely dark, expect image_quality unusable_dark. Confirm through compact diagnostics:

curl http://127.0.0.1:8765/api/status/compact | jq .vision

Snapshot Stale

Review frame_flush_reads, frame_flush_delay, and camera_buffer_size. Increasing flush reads can reduce stale frames, at the cost of extra capture latency.

Face False Positives

Inspect raw_face_count, filtered_out_count, rejected_faces, and each filter_reason. Tune face_min_size, face_min_neighbors, face_min_area_ratio, and eye validation.

Face Not Detected at Distance

Try lowering face_min_size, face_min_area_ratio, or face_min_neighbors; enable or verify CLAHE; inspect rejected_faces for overly strict filters.

WebUI Values Stale

curl -N "http://127.0.0.1:8765/api/status/stream" | head -n 3

If the stream updates but the browser does not, force cache busting for CSS/JS and check the browser console.

No LLM Response

echo $OPENROUTER_API_KEY
curl http://localhost:11434/api/tags
tail -f cosmo/data/logs/cosmo.log | grep -i llm
from cosmo.ai.llm.llm_provider import llm_provider
result = llm_provider.generate([{"role": "user", "content": "test"}])
print(result)

Database Errors

sqlite3 cosmo/data/database/cosmo.db ".tables"
sqlite3 cosmo/data/database/cosmo.db ".schema memories"
lsof | grep cosmo.db
sqlite3 cosmo/data/database/cosmo.db "INTEGRITY_CHECK;"

TTS Not Speaking

which piper
ls -la cosmo/models/piper/
which aplay
speaker-test -t sine -f 1000 -l 1
groups | grep -i audio
tail -f cosmo/data/logs/cosmo.log | grep -i tts