Troubleshooting & Diagnostics¶
This guide provides solutions to common setup, authentication, and network issues encountered when running Cantus.
1. Spotify Authentication Errors¶
Error: INVALID_CLIENT: Invalid client id¶
- Cause: The
SPOTIFY_CLIENT_IDenvironment variable is either unset, contains extra quotes, or is not registered in the Spotify Developer Dashboard. - Solution: Verify that the 32-character Client ID in
.envmatches the Developer Dashboard exactly without leading/trailing whitespace.
Error: redirect_uri: Not matching configuration or INVALID_CLIENT: Invalid redirect URI¶
- Cause: The callback URL that Cantus sent does not match the list of Redirect URIs in your Spotify Developer App settings.
- Solution:
- Check
CANTUS_HOST_URLin your.env(e.g.http://localhost:5000orhttps://cantus.yourdomain.com). - In the Spotify Developer Dashboard under Settings -> Redirect URIs, ensure
${CANTUS_HOST_URL}/api/auth/spotify/callback(e.g.http://localhost:5000/api/auth/spotify/callbackandhttp://127.0.0.1:5000/api/auth/spotify/callback) is added. - Ensure there is no trailing slash on
CANTUS_HOST_URLor redirect URI.
2. WebAssembly Client & Browser Caching¶
Symptom: Frontend appears blank or does not reflect newly authorized accounts¶
- Cause: Browsers aggressively cache WebAssembly scripts,
.wasmbinaries, and application manifest files across deployments. - Solution:
- Perform a hard refresh in your browser to bypass the cache:
- Windows / Linux: Ctrl + Shift + R or Ctrl + F5
- macOS: Cmd + Shift + R
- Open Developer Tools (F12), navigate to the Application / Storage tab, and click Clear Site Data.
- Ensure the backend container is running and healthy:
3. Real-Time WebSocket / SignalR Issues¶
Symptom: Client shows "Reconnecting..." or drops every 60 seconds¶
- Cause: The reverse proxy is killing idle WebSocket connections or failing to send upgrade headers.
- Solution:
- Verify that your proxy config includes
Upgrade $http_upgradeandConnection "upgrade". - Increase
proxy_read_timeoutandproxy_send_timeoutto300sor higher. - If using Cloudflare, verify that WebSockets is enabled in the Cloudflare Network dashboard.
4. Spotify API Rate Limiting (HTTP 429)¶
Symptom: Logs show Spotify rate limit exceeded (429)¶
- Cause: Too many requests within a short timeframe.
- Mitigation Built into Cantus:
- Cantus employs an Adaptive Polling Engine that automatically backs off to 5s intervals when playback is paused, 10s when idle, and completely halts polling when zero clients are connected to a room.
- Operator Action:
- If sharing an instance among multiple active listeners, ensure non-active browser tabs are closed. Cantus will automatically spin down polling for disconnected rooms.
5. Clock Skew & Lyric Timing Drift¶
Symptom: Lyrics appear ahead or behind audio on specific machines¶
- Diagnostics:
- Press D on the client to open the Diagnostics HUD and check NTP Clock Offset.
- If offset is
> 500ms, the host OS clock on either the server or client is desynchronized. - Solution:
- Ensure
systemd-timesyncdorchronyNTP service is running on the host server:
6. Health Checks & Server Logs¶
Checking Endpoint Health¶
The backend exposes a health endpoint:
Expected JSON response:
Inspecting Container Logs¶
View live structured logs: