Troubleshooting Guide - WatchLLM
Purpose: A centralized guide to help you resolve common issues when integrating or using WatchLLM.
1. Authentication Issues
401 Unauthorized - Invalid API Key
Symptoms: Your requests fail with a 401 status code.
- Cause: The provided API key is either missing, mistyped, or has been revoked.
- Solution:
- Ensure your API key starts with
lgw_. - Check the
Authorizationheader format:Bearer lgw_your_key_here. - Verify the key exists in your Dashboard under the specific project.
- Ensure your API key starts with
Header Mismatch
Symptoms: Requests are rejected even with a valid key.
- Cause: Some SDKs or frameworks might add default headers that conflict with WatchLLM's requirements.
- Solution: Ensure
Content-Type: application/jsonis explicitly set. Minimal headers required areAuthorizationandContent-Type.
2. Worker & Proxy Errors
500 Internal Server Error
Symptoms: A generic error message from the proxy.
- Cause: Often related to background services like D1 (Database) or Redis (Cache) being unavailable.
- Solution:
- Check the Service Status Page.
- If you are self-hosting:
- Verify
wrangler d1credentials are correct. - Ensure Upstash Redis URL/Token is properly set in
wrangler.tomlsecrets.
- Verify
502 Bad Gateway - Provider Error
Symptoms: WatchLLM is working, but the upstream AI provider is failing.
- Cause: OpenAI, Anthropic, or Groq is currently experiencing an outage.
- Solution: WatchLLM automatically attempts retries for most transient errors. Check the status of the specific provider:
3. Caching & Persistence
Cache Misses when Cache should be Hit
Symptoms: x-WatchLLM-cached header returns false repeatedly for the same query.
- Cause:
- Non-deterministic parameters: If
temperatureis high, semantic caching might require a higher similarity threshold. - Streaming: Caching behavior differs slightly for streaming responses.
- Non-deterministic parameters: If
- Solution: Check your
wrangler.tomlforSEMANTIC_CACHE_THRESHOLD. Lowering it (e.g., to0.85) increases hit rate but may reduce answer precision.
D1 Connection Errors
Symptoms: Logs show "D1_ERROR" or "Database not found".
- Cause: The Cloudflare D1 database binding name does not match what is in
worker/src/lib/d1.ts. - Solution: Ensure your
wrangler.tomlhas[[d1_databases]]withbinding = "DB".
4. Rate Limits & Quotas
429 Too Many Requests
Symptoms: Plan limit reached.
- Solution:
- Check
X-RateLimit-Remainingheader to see how close you are to the limit. - Upgrade your plan in the Dashboard if you've outgrown the current tier.
- Implement exponential backoff in your application code.
- Check
5. Development & Local Debugging
Wrangler Preview Issues
- Problem: Environmental variables (
OPENROUTER_API_KEY, etc.) aren't loading locally. - Fix: Create a
.dev.varsfile in theworkerdirectory with your secrets (format:KEY=VALUE).
Logs Tracking
To see live logs from your deployed worker:
wrangler tailThis is the fastest way to identify the exact line of code causing a 500 error.
Still having issues?
- GitHub Issues: WatchLLM/Issues
- Discord Support: Join our community
- Email: support@WatchLLM.com