1. Error
Receiving 1007 error from Gemini Live API
2. System
Windows 11
3. Context
- The only model I am using is → REALTIME_MODEL = “gemini-2.5-flash-native-audio-preview-12-2025”
- Crash occurrence is complicated because in one session there is no crash despite of tool calls and rag querys and in another session the same error occurs during a query, mid-conversation, or due to a tool call(still unknown).
- My application allows both TEXT and real time AUDIO input/conversation using Gemini Live Api and LiveKit
4. My pyproject.toml
requires-python = ">=3.10,<3.14"
dependencies = [
"livekit-agents[google]~=1.5",
"google-genai>=1.30.0",
"python-dotenv>=1.0.0",
"flask>=3.1.3",
"livekit-api>=1.1.0",
"flask-cors>=6.0.2",
"llama-index-vector-stores-qdrant>=0.10.1",
"qdrant-client>=1.18.0",
"fastembed>=0.8.0",
]
------------------ OR -----------------------
Package Version
fastembed 0.8.0
flask 3.1.3
flask-cors 6.0.2
google-api-core 2.29.0
google-cloud-speech 2.36.0
google-cloud-texttospeech 2.34.0
google-genai 2.14.0
httpcore 1.0.9
httpx 0.28.1
huggingface-hub 1.24.0
livekit 1.1.13
livekit-agents 1.6.6
livekit-api 1.2.0
livekit-local-inference 0.2.6
livekit-plugins-google 1.6.6
livekit-protocol 1.1.21
websockets 15.0.1
5. Here is my entrypoint/session code
server = AgentServer()
# 1. PREWARM: Loads RAG once per worker process into process userdata
# i.e., one RAG pipeline across all sessions
def prewarm(proc: JobProcess):
logger.info("Prewarming worker: Light startup (deferring RAG load to first request)...")
server.setup_fnc = prewarm
@server.rtc_session(agent_name="xyz")
async def entrypoint(ctx: agents.JobContext):
await ctx.connect()
# Lazy-load RAG engine per worker instance on demand
if "query_engine" not in ctx.proc.userdata:
logger.info("Initializing shared RAG query engine on first request...")
ctx.proc.userdata["query_engine"] = initialize_query_engine(
collection_name="xyz-index"
)
query_engine = ctx.proc.userdata["query_engine"]
participant = await ctx.wait_for_participant()
web_identity = participant.identity
logger.info(f"Frontend participant connected: {web_identity}")
session = AgentSession(
llm=google.realtime.RealtimeModel(
model=REALTIME_MODEL, # Strictly only using "gemini-2.5-flash-native-audio-preview-12-2025"
voice="Callirrhoe",
modalities=["AUDIO"], # also tried with this line removed
),
)
agent = MyClassAgent(room=ctx.room, query_engine=query_engine, web_identity=web_identity, agent_session=session)
logger.info(f"Model: {REALTIME_MODEL}")
logger.info("Starting AUDIO native session")
await session.start(
room=ctx.room,
agent=agent,
)
if __name__ == "__main__":
agents.cli.run_app(server)
6. Error I see in LiveKit’s session’s logs:
Severity
Logger
__mp_main__
Message
Initializing shared RAG query engine on first request...
Attributes
{
code.file.path: "/app/agent.py"
code.function.name: "entrypoint"
code.line.number: 436
room_id: ""
job_id: ""
logger.name: "__mp_main__"
lk.id: ""
}
Severity
Logger
__mp_main__
Message
Frontend participant connected: user-xyz
Attributes
{
code.file.path: "/app/agent.py"
code.function.name: "entrypoint"
code.line.number: 446
room_id: ""
job_id: ""
logger.name: "__mp_main__"
lk.id: ""
}
Severity
Logger
__mp_main__
Message
Model: gemini-2.5-flash-native-audio-preview-12-2025
Attributes
{
code.file.path: "/app/agent.py"
code.function.name: "entrypoint"
code.line.number: 458
room_id: ""
job_id: ""
logger.name: "__mp_main__"
lk.id: ""
}
Severity
Logger
__mp_main__
Message
Starting AUDIO native session
Attributes
{
code.file.path: "/app/agent.py"
code.function.name: "entrypoint"
code.line.number: 459
room_id: ""
job_id: ""
logger.name: "__mp_main__"
lk.id: ""
}
Severity WARN
Logger
livekit.agents
Message
turn_detection is a TurnDetector, but the LLM is a RealtimeModel with server-side turn detection enabled, ignoring the turn_detection setting
Attributes
{
code.file.path: "/app/.venv/lib/python3.12/site-packages/livekit/agents/voice/agent_activity.py"
code.function.name: "_validate_turn_detection"
code.line.number: 279
room_id: ""
job_id: ""
logger.name: "livekit.agents"
lk.id: ""
}
"Severity
Logger
livekit.plugins.google
Message
error in receive task":1007 None. The audio content type ("CONTENT_TYPE_AUDIO) is not supported for this model configuration."{
"code.file.path":"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py",
"code.function.name":"_recv_task",
"code.line.number":1134,
"exception.type":"APIError",
"exception.message":"1007 None. The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.",
"exception.stacktrace":"Traceback (most recent call last):\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 527, in _receive\n raw_response = await self._ws.recv(decode=False)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.12/site-packages/websockets/asyncio/connection.py\", line 322, in recv\n raise self.protocol.close_exc from self.recv_exc\nwebsockets.exceptions.ConnectionClosedError: received 1007 (invalid frame payload data) The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.; then sent 1007 (invalid frame payload data) The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py\", line 1064, in _recv_task\n async for response in session.receive():\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 446, in receive\n while result := await self._receive():\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 537, in _receive\n errors.APIError.raise_error(code, reason, None)\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/errors.py\", line 188, in raise_error\n raise cls(status_code, response_json, response)\ngoogle.genai.errors.APIError: 1007 None. The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.\n",
"room_id":"",
"job_id":"",
"logger.name":"livekit.plugins.google",
"lk.id":""
}
"Severity
Logger
livekit.plugins.google
Message
Gemini Realtime API error":1007 None. The audio content type ("CONTENT_TYPE_AUDIO) is not supported for this model configuration."{
"code.file.path":"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py",
"code.function.name":"_main_task",
"code.line.number":954,
"exception.type":"APIError",
"exception.message":"1007 None. The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.",
"exception.stacktrace":"Traceback (most recent call last):\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 527, in _receive\n raw_response = await self._ws.recv(decode=False)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.12/site-packages/websockets/asyncio/connection.py\", line 322, in recv\n raise self.protocol.close_exc from self.recv_exc\nwebsockets.exceptions.ConnectionClosedError: received 1007 (invalid frame payload data) The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.; then sent 1007 (invalid frame payload data) The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py\", line 944, in _main_task\n raise err\n File \"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py\", line 1064, in _recv_task\n async for response in session.receive():\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 446, in receive\n while result := await self._receive():\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 537, in _receive\n errors.APIError.raise_error(code, reason, None)\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/errors.py\", line 188, in raise_error\n raise cls(status_code, response_json, response)\ngoogle.genai.errors.APIError: 1007 None. The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.\n",
"room_id":"",
"job_id":"",
"logger.name":"livekit.plugins.google",
"lk.id":""
}
"Severity
Logger
livekit.plugins.google
Message
Gemini Live closed the session":context exhausted (1007). Reconnecting would replay the same context and fail again; terminating the session.{
"code.file.path":"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py",
"code.function.name":"_main_task",
"code.line.number":962,
"exception.type":"APIError",
"exception.message":"1007 None. The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.",
"exception.stacktrace":"Traceback (most recent call last):\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 527, in _receive\n raw_response = await self._ws.recv(decode=False)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.12/site-packages/websockets/asyncio/connection.py\", line 322, in recv\n raise self.protocol.close_exc from self.recv_exc\nwebsockets.exceptions.ConnectionClosedError: received 1007 (invalid frame payload data) The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.; then sent 1007 (invalid frame payload data) The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py\", line 944, in _main_task\n raise err\n File \"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py\", line 1064, in _recv_task\n async for response in session.receive():\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 446, in receive\n while result := await self._receive():\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 537, in _receive\n errors.APIError.raise_error(code, reason, None)\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/errors.py\", line 188, in raise_error\n raise cls(status_code, response_json, response)\ngoogle.genai.errors.APIError: 1007 None. The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.\n",
"room_id":"",
"job_id":"",
"logger.name":"livekit.plugins.google",
"lk.id":""
}
"Severity
Logger
livekit.agents
Message
AgentSession is closing due to unrecoverable error"{
"code.file.path":"/app/.venv/lib/python3.12/site-packages/livekit/agents/voice/agent_session.py",
"code.function.name":"_on_error",
"code.line.number":1636,
"exception.type":"APIError",
"exception.message":"1007 None. The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.",
"exception.stacktrace":"Traceback (most recent call last):\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 527, in _receive\n raw_response = await self._ws.recv(decode=False)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.12/site-packages/websockets/asyncio/connection.py\", line 322, in recv\n raise self.protocol.close_exc from self.recv_exc\nwebsockets.exceptions.ConnectionClosedError: received 1007 (invalid frame payload data) The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.; then sent 1007 (invalid frame payload data) The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py\", line 944, in _main_task\n raise err\n File \"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py\", line 1064, in _recv_task\n async for response in session.receive():\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 446, in receive\n while result := await self._receive():\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 537, in _receive\n errors.APIError.raise_error(code, reason, None)\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/errors.py\", line 188, in raise_error\n raise cls(status_code, response_json, response)\ngoogle.genai.errors.APIError: 1007 None. The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.\n",
"room_id":"",
"job_id":"",
"logger.name":"livekit.agents",
"lk.id":""
}
"Severity
Logger
livekit.plugins.google
Message
Error in _main_task"{
"code.file.path":"/app/.venv/lib/python3.12/site-packages/livekit/agents/utils/log.py",
"code.function.name":"async_fn_logs",
"code.line.number":22,
"exception.type":"APIConnectionError",
"exception.message":"Gemini Live session context exhausted (1007)",
"exception.stacktrace":"Traceback (most recent call last):\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 527, in _receive\n raw_response = await self._ws.recv(decode=False)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.12/site-packages/websockets/asyncio/connection.py\", line 322, in recv\n raise self.protocol.close_exc from self.recv_exc\nwebsockets.exceptions.ConnectionClosedError: received 1007 (invalid frame payload data) The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.; then sent 1007 (invalid frame payload data) The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py\", line 944, in _main_task\n raise err\n File \"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py\", line 1064, in _recv_task\n async for response in session.receive():\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 446, in receive\n while result := await self._receive():\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/live.py\", line 537, in _receive\n errors.APIError.raise_error(code, reason, None)\n File \"/app/.venv/lib/python3.12/site-packages/google/genai/errors.py\", line 188, in raise_error\n raise cls(status_code, response_json, response)\ngoogle.genai.errors.APIError: 1007 None. The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/app/.venv/lib/python3.12/site-packages/livekit/agents/utils/log.py\", line 17, in async_fn_logs\n return await fn(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/app/.venv/lib/python3.12/site-packages/livekit/plugins/google/realtime/realtime_api.py\", line 969, in _main_task\n raise APIConnectionError(\nlivekit.agents._exceptions.APIConnectionError: Gemini Live session context exhausted (1007)\n",
"room_id":"",
"job_id":"",
"logger.name":"livekit.plugins.google",
"lk.id":""
}
"Severity
Logger
root
Message
ignoring text stream with topic""lk.chat",
"no callback attached"{
"code.file.path":"/app/.venv/lib/python3.12/site-packages/livekit/rtc/room.py",
"code.function.name":"_handle_stream_header",
"code.line.number":1092,
"room_id":"",
"job_id":"",
"logger.name":"root",
"lk.id":""
}