WebSocket connection to Gemini Live API closes unexpectedly with error code 1008 and reason: "Operation is not implemented, or supported, or enabled."
Environment
| Component |
Version/Value |
| SDK |
@google/genai (latest) |
| Model |
models/gemini-2.5-flash-native-audio-preview-12-2025 |
| Platform |
Browser (Chrome/Edge) via Next.js 16.x |
| Connection Type |
Direct WebSocket (Live API) |
| Audio Input |
16-bit PCM, 16kHz, mono, little-endian |
| Audio Output |
16-bit PCM, 24kHz, mono, little-endian |
Error Details
Console Output
direct-gemini-client.ts:244 🔌 Gemini connection closed (code: 1008, reason: Operation is not implemented, or supported, or enabled.)
Steps to Reproduce
- Initialize
GoogleGenAI client with valid API key
- Connect to Live API with audio modality:
import { GoogleGenAI, LiveConnectConfig, Modality } from "@google/genai";
const client = new GoogleGenAI({ apiKey: "VALID_API_KEY" });
const config: LiveConnectConfig = {
responseModalities: [Modality.AUDIO],
speechConfig: {
voiceConfig: {
prebuiltVoiceConfig: {
voiceName: "Aoede"
}
}
},
systemInstruction: {
parts: [{ text: "You are a helpful assistant." }]
},
// Generation config fields set directly (not nested)
temperature: 0.7,
topP: 0.9,
topK: 40,
// Realtime input config
realtimeInputConfig: {
automaticActivityDetection: {
disabled: true
}
}
};
await client.live.connect({
model: "models/gemini-2.5-flash-native-audio-preview-12-2025",
config,
callbacks: {
onopen: () => console.log("Connected"),
onclose: (event) => console.log(`Closed: ${event.code} - ${event.reason}`),
onerror: (error) => console.error("Error:", error),
onmessage: (message) => console.log("Message:", message)
}
});
- Start sending audio chunks (16-bit PCM, 16kHz):
session.sendRealtimeInput({
media: {
mimeType: "audio/pcm;rate=16000",
data: base64AudioChunk // 20-40ms chunks as recommended
}
});
- Connection closes with error 1008 after a few seconds or during first audio response
Expected Behavior
- WebSocket connection should remain stable
- Audio input should be processed
- Audio response should be received completely
- Connection should only close on explicit disconnect or timeout
Actual Behavior
- Connection establishes successfully (
onopen fires)
- First audio response may start streaming
- Connection abruptly closes with code 1008
- Error message: "Operation is not implemented, or supported, or enabled."
Deprecation Warning Observed
Before the error, this deprecation warning appears:
Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. This will become an error in a future version (not before Q3 2025).
Note: Even after fixing the deprecated config (moving generationConfig fields to top-level), the 1008 error still occurs.
Configuration Attempts
Attempt 1: Original (with deprecated nested config)
// ❌ Deprecated - causes warning
const config = {
responseModalities: [Modality.AUDIO],
generationConfig: {
temperature: 0.7,
topP: 0.9,
topK: 40
}
};
Attempt 2: Fixed (fields at top level)
// ✅ Correct per deprecation notice - still causes 1008
const config = {
responseModalities: [Modality.AUDIO],
temperature: 0.7,
topP: 0.9,
topK: 40
};
Attempt 3: With realtimeInputConfig
// Tried disabling automatic activity detection - still causes 1008
const config = {
responseModalities: [Modality.AUDIO],
temperature: 0.7,
realtimeInputConfig: {
automaticActivityDetection: {
disabled: true
}
}
};
Audio Streaming Details
Following Google's best practices for streaming:
| Setting |
Value |
Best Practice |
| Chunk Size |
20-40ms |
✅ Recommended |
| Sample Rate (Input) |
16kHz |
✅ Required |
| Sample Rate (Output) |
24kHz |
✅ Expected |
| Bit Depth |
16-bit PCM |
✅ Required |
| Channels |
Mono |
✅ Required |
| Endianness |
Little-endian |
✅ Required |
Workarounds Attempted
Request
Please provide:
- Root cause of the 1008 error
- Correct configuration for stable Live API WebSocket connections
- Any model-specific requirements for audio streaming
- Updated documentation if the API behavior has changed
Additional Context
This issue occurs in a real-time voice interview application where:
- User speaks → Audio captured at 16kHz
- Audio sent to Gemini Live API in small chunks (20-40ms)
- AI responds with audio at 24kHz
- Response played back to user
The application works correctly for initial connection but fails intermittently with 1008 errors, making it impossible to complete a full voice conversation.
WebSocket connection to Gemini Live API closes unexpectedly with error code 1008 and reason:
"Operation is not implemented, or supported, or enabled."Environment
@google/genai(latest)models/gemini-2.5-flash-native-audio-preview-12-2025Error Details
Console Output
Steps to Reproduce
GoogleGenAIclient with valid API keyExpected Behavior
Actual Behavior
onopenfires)Deprecation Warning Observed
Before the error, this deprecation warning appears:
Note: Even after fixing the deprecated config (moving
generationConfigfields to top-level), the 1008 error still occurs.Configuration Attempts
Attempt 1: Original (with deprecated nested config)
Attempt 2: Fixed (fields at top level)
Attempt 3: With realtimeInputConfig
Audio Streaming Details
Following Google's best practices for streaming:
Workarounds Attempted
generationConfigto top-level fieldsrealtimeInputConfig.automaticActivityDetection.disabled: trueRequest
Please provide:
Additional Context
This issue occurs in a real-time voice interview application where:
The application works correctly for initial connection but fails intermittently with 1008 errors, making it impossible to complete a full voice conversation.