Repository navigation
Description
Describe the Bug:
GeminiLlmConnection only translates serverContent, toolCall, usageMetadata, toolCallCancellation and setupComplete. Every other Live server message falls into the catch-all and is emitted as an error response (errorCode = "Unknown server message."). In a normal Live call this happens for two documented message types:
goAway: the server's warning that it is about to close the connection, withtimeLeft. ADK drops the payload, so callers can't react (for example by resuming the session) before the connection closes. The call then dies.voiceActivity(ACTIVITY_START/ACTIVITY_END): when the server reports the user starting or stopping speech, ADK emits an error event.
Both are valid messages in google-genai's LiveServerMessage (goAway(), voiceActivity(), voiceActivityDetectionSignal()), and the SDK parses them correctly. The loss is in ADK. (Separate, known SDK issue: voiceActivity frames that include audioOffset can fail to parse, googleapis/java-genai#1120.)
Cause, in core/src/main/java/com/google/adk/models/GeminiLlmConnection.java: convertToServerResponse has no branch for message.goAway(), voiceActivity() or voiceActivityDetectionSignal(). An unmatched message reaches createUnknownMessageResponse(), which sets errorCode(new FinishReason("Unknown server message.")) and errorMessage("Received unknown server message.") (~line 286 on main). A case-insensitive search of the adk-java tree for goaway finds no handling anywhere.
Steps to Reproduce:
- Run a Live (BIDI) session with
Runner.runLive(...)against a Gemini Live model, with audio input andStreamingMode.BIDI. - Keep the session open about 9 minutes. The server sends
goAway(timeLeft30s), which produces an event witherrorCode = "Unknown server message.". The connection then closes about 30 seconds later. - For
voiceActivity: also configureAutomaticActivityDetectionthroughRealtimeInputConfigin theLiveConnectConfig(ADK has noRunConfigoption for this today, so it has to be injected, for example by overridingGemini.connectLiveTransport). Then speak and stop speaking. Each start and stop produces the same error event. I have not tested whether the server sendsvoiceActivitywithout that configuration.
Expected Behavior:
Valid Live messages are not reported as errors. goAway (including timeLeft) is available to the caller. ADK Python does this: LlmResponse.go_away (llm_response.py) is set in gemini_llm_connection.py (~line 670) and handled in live/_live_llm_flow.py (~line 260). voiceActivity signals should be surfaced or ignored, not turned into errors.
Observed Behavior:
From a real call (raw frames logged by a transport wrapper beneath ADK; tSec is seconds since connect):
[tSec=452] <- UNTRANSLATED frame (types=voiceActivity, adkWouldSay="Unknown server message"): {"voiceActivity":{"voiceActivityType":"ACTIVITY_START"}}
-> ADK emits an event with errorCode="Unknown server message."
[tSec=453] <- UNTRANSLATED frame (types=voiceActivity, adkWouldSay="Unknown server message"): {"voiceActivity":{"voiceActivityType":"ACTIVITY_END"}}
-> ADK emits an event with errorCode="Unknown server message."
[tSec=540] <- UNTRANSLATED frame (types=goAway, adkWouldSay="Unknown server message"): {"goAway":{"timeLeft":"30s"}}
-> ADK emits an event with errorCode="Unknown server message."
[tSec=571] sendRealtimeInput FAILED (sinceLastInboundSec=30): java.util.concurrent.CompletionException: org.java_websocket.exceptions.WebsocketNotConnectedException
[tSec=571] close() called on transport (inboundFrames=129, counts={goAway=1, serverContent=124, serverContent+usageMetadata=2, voiceActivity=2})
So the server sent goAway with 30 seconds left (at 9:00), and it closed the connection exactly 30 seconds later (at 9:31). Nothing in ADK reacted, and the call died while the caller was still sending audio.
Environment Details:
- ADK Library Version : 1.15.0
- OS: macOS
- Java Version (java -version): OpenJDK 21.0.7
Model Information:
- Which model is being used: gemini-3.8-live
🟡 Optional Information
Regression:
No. main (1.15.1-SNAPSHOT) behaves the same way.
Logs:
See "Observed Behavior" above. Session identifiers and user details are removed. The full set of frame types for that session was: serverContent (124), serverContent+usageMetadata (2), voiceActivity (2), goAway (1).
Additional Context:
google-genaiparses all of these messages correctly. Both fields are present onLiveServerMessage.- Suggested fix: add a
goAwayfield (LiveServerGoAway) toLlmResponse, set it inGeminiLlmConnectionwhenmessage.goAway()is present, and pass it through the live flow (and ontoEvent). HandlevoiceActivityandvoiceActivityDetectionSignalsimilarly, or at least ignore them without creating an error response. - Workaround today: wrap the transport returned by the protected
Gemini.connectLiveTransport(...)and intercept these frames before they reachGeminiLlmConnection. - Related: Is
SessionResumptionConfigplanned to be added? #663 (session resumption). A client that getsgoAwayearly can resume the session before the close. I'm filing a separate feature request for exposing live config (VAD, context window compression, session resumption) inRunConfig.
Minimal Reproduction Code:
Runner runner = new Runner(agent, "app", new InMemorySessionService());
RunConfig runConfig = RunConfig.builder()
.setStreamingMode(RunConfig.StreamingMode.BIDI)
.build();
runner.runLive(session, liveRequestQueue, runConfig)
.subscribe(event -> {
// After ~9 minutes on goAway (and on voiceActivity, if VAD is configured):
// event.errorCode() == "Unknown server message."
});How often has this issue occurred?:
- Always (100%): every
goAway, and everyvoiceActivityframe when VAD is configured.
Activity
hemasekhar-p commentedon Nov 20, 2026
Hi @aparnasharma285, thank you for reporting this issue. I have been able to reproduce it using your inputs. This issue is currently under review by our team, and we will keep you updated if we require any further information.