Authentication Issues
Authentication Failed Error
Authentication Failed Error
Problem: Receiving 401 error when requesting tokenSolutions:
- Verify your
DEVICE_API_KEYis correct - Ensure your
DEVICE_IDmatches the registered device - Check that your device hasn’t been deactivated
- Confirm you’re using the correct API endpoint URL
Token Expired Error
Token Expired Error
Problem: WebSocket connection fails with expired tokenSolutions:
- Tokens expire after 1 minute - don’t cache them
- Request a new token for each connection attempt
- Implement automatic retry with new token
WebSocket Connection Issues
Connection Fails to Establish
Connection Fails to Establish
Possible Causes & Solutions:
-
Incorrect WebSocket URL
- Ensure you’re converting HTTP to WS:
http://→ws://,https://→wss:// - Verify the
/voice-streamendpoint path
- Ensure you’re converting HTTP to WS:
-
Network/Firewall Issues
- Check if your network allows WebSocket connections
- Try connecting from a different network
-
Server Not Running
- Verify your server is running and accessible
- Test with a simple HTTP request first
Connection Drops Unexpectedly
Connection Drops Unexpectedly
Problem: WebSocket disconnects during conversationSolutions:
- Implement reconnection logic with exponential backoff
- Add connection heartbeat/ping mechanism
- Check network stability
Audio Issues
No Audio Being Transmitted
No Audio Being Transmitted
Troubleshooting Steps:
-
Check Microphone Permission
-
Verify Audio Format
- Must be: 16kHz, 16-bit, mono PCM
- Check recorder configuration:
-
Test Audio Recording
Audio Quality Issues (Static/Distortion)
Audio Quality Issues (Static/Distortion)
Common Causes & Solutions:
-
Incorrect Audio Format
- Must use: 16-bit PCM, 16,000 Hz, Mono
- Not: 8-bit, different sample rates, or stereo
-
Buffer Size Issues
- Try adjusting audio buffer sizes
- Ensure consistent streaming
-
Network Issues
- Check for packet loss
- Verify stable internet connection
Flutter-Specific Issues
flutter_sound Package Issues
flutter_sound Package Issues
Solutions:
-
Update Dependencies
- Platform-Specific Setup For Windows, ensure you have proper audio drivers and permissions.
-
Alternative Audio Package
If
flutter_sounddoesn’t work, try:
Environment Variables Not Loading
Environment Variables Not Loading
Solutions:
-
Check File Location
.envfile must be in project root- Same directory as
pubspec.yaml
-
Verify
pubspec.yamlConfiguration -
Load Environment Early
Debug Logging
Enable comprehensive logging to troubleshoot issues:Common Error Codes
| Error Code | Description | Solution |
|---|---|---|
INVALID_REQUEST | Missing required parameters | Check request format |
AUTHENTICATION_FAILED | Invalid credentials | Verify API key and device ID |
DEVICE_INACTIVE | Device deactivated | Contact support |
TOKEN_EXPIRED | JWT token expired | Request new token |
INVALID_AUDIO_FORMAT | Wrong audio format | Use 16kHz, 16-bit, mono PCM |
CONNECTION_TIMEOUT | WebSocket timeout | Check network connectivity |
Getting Help
If you’re still experiencing issues:- Check Error Messages: Look for specific error codes and messages
- Test Network Connectivity: Ensure your server is accessible
- Verify Credentials: Double-check API keys and device IDs
- Update Dependencies: Ensure you’re using compatible package versions
- Contact Support: Reach out at [email protected]