Google generative AI: Unable to generate response

I have a weird issue with Google Generative AI (using recommended model settings). Most of my commands work fine, but some commands consistently fail with the error message “Unable to generate response”. Simply asking to turn on the kitchen light will almost always fail. If I ask if the light is on, it knows about it though and in a follow-up question is can actually turn it on.

In the system log, I get these errors:

Logger: homeassistant.components.conversation.util
Source: components/conversation/util.py:35
integration: Conversation (documentation, issues)
First occurred: 9:07:20 AM (11 occurrences)
Last logged: 2:51:08 PM

Last content in chat log is not an AssistantContent: UserContent(role='user', content='turn off dinner table light', attachments=None). This could be due to the model not returning a valid response
Last content in chat log is not an AssistantContent: UserContent(role='user', content='turn off the kitchen light', attachments=None). This could be due to the model not returning a valid response
Last content in chat log is not an AssistantContent: UserContent(role='user', content='turn on the kitchen light', attachments=None). This could be due to the model not returning a valid response
Last content in chat log is not an AssistantContent: UserContent(role='user', content='turn on the living room light', attachments=None). This could be due to the model not returning a valid response
Last content in chat log is not an AssistantContent: UserContent(role='user', content='turn on the lights in the living room', attachments=None). This could be due to the model not returning a valid response

Any idea how I can understand what is happening? Interestingly, when I switch to gemini-2.5-pro, I get a more elaborate error:

This error is just repeated in the logs:

Logger: homeassistant.components.google_generative_ai_conversation
Source: components/google_generative_ai_conversation/entity.py:308
integration: Google Generative AI (documentation, issues)
First occurred: 8:58:40 AM (6 occurrences)
Last logged: 2:57:57 PM

Error sending message: <class 'google.genai.errors.ServerError'> 500 Internal Server Error. {'message': '{\n "error": {\n "code": 500,\n "message": "An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting",\n "status": "INTERNAL"\n }\n}\n', 'status': 'Internal Server Error'}

According to that webpage, it would be a server error, hinting that the input context might be too large. But that seems odd since other commands seem to work fine? I do have 130 devices exposed though?

3 Likes

this wont help you but ion my case the situation is strange, if i try the same assist in phone it’s always returns unable to get response. if i go to assist in my computer, via browser, not app - it always works!

1 Like

Same happening to me Last content in chat log is not an AssistantContent: UserContent(...

If gets fixed if I go to the integration (gemini), try to edit it, change nothing, save.

Also, it only happens when I use Assist via voice, by text the issue never happens.

I have exactly the same issue with “unable to get response”. And after switching to a higher Gemini tier (Pro) I started getting a 500 error. Saving the integration without editing didn’t help in my case, I even removed all custom AI instructions and the problem still occurred. It happens on my phone, on my computer, and also when I trigger the voice assistant through a speaker. Have you managed to solve this problem somehow?

Unfortunately I did not. I gave up on gemini. It’s a real shame since it is truly faster then OpenAI or Anthrophic when it works. It just doesn’t work reliably enough to properly use it.

1 Like

What model or models are you using now? Did the switch from Gemini to another model go smoothly, without any major changes to scripts, aliases, etc.?

I mostly use gpt-4o-mini. I find it works best for my needs, though it is just a tad too slow to be really enjoyable (~2s-5s response time depending on time of day and complexity of the question I ask). I mostly use the voice assist, so switching between conversation agents is extremely trivial (once you have them setup), just a few button clicks. I still have 2 assist pipelines configured, one with gemini and one with gpt-4o-mini as conversation agent. So once in a while I can try gemini again to see if the problem is fixed.

I imagine if you use assist actions in scripts/automations, you will have more work to change all those over.

I get the same issue from time to time. More often these days.

How can we log this? I have no idea at which point the issue might be.

Hello, I wonder if the problem has been solved? I often have this mistake

“Unable to get response”

Continuity is not used when it gives an error

Hello,

I started having this issue recently after playing around with the different models. After switching back to Gemini 2.0 Flash, it disappears. I think it might be the same for you.

1 Like

I have this problem too. In my case I give a command to the voice assistant, which also uses Google generative AI, to turn off the AC in 3 hours, but I get this error in the moment it should turn off the AC:

Logger: homeassistant.components.conversation.util
Source: components/conversation/util.py:35
integration: Conversation (documentation, issues)
First occurred: November 27, 2025 at 10:54:59 PM (2 occurrences)
Last logged: 2:22:48 AM

Last content in chat log is not an AssistantContent: UserContent(role='user', content='Desligue o ar-condicionado', attachments=None, created=datetime.datetime(2025, 11, 28, 1, 54, 58, 520207, tzinfo=datetime.timezone.utc)). This could be due to the model not returning a valid response
Last content in chat log is not an AssistantContent: UserContent(role='user', content='Desligue o ar-condicionado', attachments=None, created=datetime.datetime(2025, 11, 30, 5, 22, 46, 563897, tzinfo=datetime.timezone.utc)). This could be due to the model not returning a valid response

I was struggling with this too. I went to check the Gemini API key https://aistudio.google.com/app/apikey and discovered that my API key and project were gone. I don’t know why it was missing (perhaps it expired since it was a “Free tier” plan that I was using for testing).

I discovered the same GitHub issue here: Google Gemini - API key update \ renewal · Issue #154449 · home-assistant/core · GitHub.

I did the following:

  1. deleted the Voice Assistant (Settings → Voice assistants) and
  2. deleted the Google Gemini integration (Settings → Devices & services).
  3. rebooted / restarted Home Assistant
  4. generated a new Google Gemini API key
  5. installed the Google Gemini Integration
  6. added a new assistant using Gemini.

Everything appears to be working but I am still testing.

1 Like

in the https://aistudio.google.com/app/projects
check on top-right and click ‘Import Projects’, it should list your past projects and you should be able to restore it.

I didn’t think to look at Import Projects - thanks for the tip.
Unfortunately, I am still getting intermittent “Unable to give response” issues. I suspect something with the datetime. Troubleshooting continues.

Logger: homeassistant.components.conversation.util
Source: components/conversation/util.py:35
integration: Conversation (documentation, issues)
First occurred: December 4, 2025 at 5:11:42 PM (6 occurrences)
Last logged: 5:38:36 PM

Last content in chat log is not an AssistantContent: UserContent(role='user', content='Turn on family room light.', attachments=None, created=datetime.datetime(2025, 12, 5, 21, 23, 42, 445869, tzinfo=datetime.timezone.utc)). This could be due to the model not returning a valid response
Last content in chat log is not an AssistantContent: UserContent(role='user', content='Is Mark home?', attachments=None, created=datetime.datetime(2025, 12, 5, 21, 23, 51, 287118, tzinfo=datetime.timezone.utc)). This could be due to the model not returning a valid response
Last content in chat log is not an AssistantContent: UserContent(role='user', content='What time is it?', attachments=None, created=datetime.datetime(2025, 12, 5, 21, 23, 59, 262942, tzinfo=datetime.timezone.utc)). This could be due to the model not returning a valid response
Last content in chat log is not an AssistantContent: UserContent(role='user', content='What time is it?', attachments=None, created=datetime.datetime(2025, 12, 5, 22, 36, 9, 618234, tzinfo=datetime.timezone.utc)). This could be due to the model not returning a valid response
Last content in chat log is not an AssistantContent: UserContent(role='user', content='What time is it?', attachments=None, created=datetime.datetime(2025, 12, 5, 22, 38, 35, 582248, tzinfo=datetime.timezone.utc)). This could be due to the model not returning a valid response

For me, this is certainly not the issue. I am on paid Tier 1 and my API was just showing up in ai studio projects. I still get the issue with certain commands.

Hello everyone,

I was experiencing the exact same issue/problem as described here.

After trying a few things, I decided to switch the model I was using to

gemini-flash-latest

So far, it has been working perfectly and the performance is also excellent and reliable.

I’m not entirely sure which specific model iteration or version is running behind the scenes when using the “latest” alias, but it definitely resolved the problem for me.

Hope this helps others who are struggling!

1 Like

Wild thought - why don’t you ask it to fix itself? After all, it is supposed to be ‘intelligent’.

Laughs uproariously.

Sorry, couldn’t resist.

I tried gemini-flash-latest. It still regularly throws errors. But now the error is different:

Sorry, I had a problem getting a response from Google Generative AI.: { "error": { "code": 400, "message": "Please ensure that function response turn comes immediately after a function call turn.", "status": "INVALID_ARGUMENT" } }

Same here, tried gemini-flash-lates but still getting “Unable to get response”

Logs show

Logger: homeassistant.components.conversation.util
Source: components/conversation/util.py:35
integration: Conversation ([documentation](https://www.home-assistant.io/integrations/conversation), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+conversation%22))
First occurred: 00:03:18 (1 occurrence)
Last logged: 00:03:18

Last content in chat log is not an AssistantContent: UserContent(role='user', content='turn on the bench light in the office and tell me the temperature in şile', attachments=None, created=datetime.datetime(2025, 12, 8, 21, 3, 14, 517603, tzinfo=datetime.timezone.utc)). This could be due to the model not returning a valid response

aistudio.google.com logs show 200 ok so the response is sent but the content seems to be missing parts.

The input has no function calling information in it as I see.

So the output gives nothing not even text, not sure why that is.

This is the content section of the output; some parts are missing :slight_smile:

"content": {
  "role": "model"
},

A successful output looks like this;


"content": {
        "parts": [
          {
            "text": "Ç"
          },
          {
            "text": "ocuk odasındaki ışığı kırmızıya ayarladım."
          },
          {
            "text": ""
          }
        ],
        "role": "model"
      },

I’ve been troubleshooting this for a few hours and finally got logging enabled on the Google Studio side. All of these requests have the same error (visible in raw only). “finishReason”: “STOP”

Here is the full error (minus tokens) if this means something. The request is really long, including all my home assistant devices and scripts. So I’m wondering if its a loading issue with Google that ChatGPT handles better per request.

{
  "candidates": [
    {
      "content": {
        "role": "model"
      },
      "finishReason": "STOP"
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 9639,
    "totalTokenCount": 9639,
    "promptTokensDetails": [
      {
        "modality": "TEXT",
        "tokenCount": 9639
      }

Side note, and its too soon to tell so I’ll report back, but I found a ton of the request was taken up by these two blueprint scripts I totally forgot I added a long time ago. One for Music assistant and one to get decent weather. I unexpesed them to the LLM and my Google responses started working. Not sure its whats in them vs just the added bulk they make to the request I send that causes the issue: