# Issue with "gemini-2.0-flash-exp" model returning an error

**URL:** <https://community.crewai.com/t/issue-with-gemini-2-0-flash-exp-model-returning-an-error/4171>\
**Category:** LLMs\
**Tags:** gpt4o\
**Created:** [February 25, 2025, 12:13pm UTC](https://community.crewai.com/t/issue-with-gemini-2-0-flash-exp-model-returning-an-error/4171 "2025-02-25T12:13:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alan\_Costa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/alan_costa/32/2212_2.png) [@Alan\_Costa](https://community.crewai.com/u/Alan_Costa)\
**Post date:** [February 25, 2025, 12:13pm UTC](https://community.crewai.com/t/issue-with-gemini-2-0-flash-exp-model-returning-an-error/4171/1 "2025-02-25T12:13:51Z")

</div>

Hello, community!

I’m trying to use the **“gemini-2.0-flash-exp”** model, but I keep getting the error below. However, when I switch to **“gemini-1.5-flash”** , everything works fine.

Has anyone encountered this issue before and can help me?

pgsql

CopiarEditar

```auto
in _get_llm_response
    raise ValueError("Invalid response from LLM call - None or empty.")
ValueError: Invalid response from LLM call - None or empty.

```

---

<div class="post-metadata">

**Author:** ![rokbenko](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/rokbenko/32/492_2.png) [@rokbenko](https://community.crewai.com/u/rokbenko)\
**Post date:** [March 1, 2025, 12:23pm UTC](https://community.crewai.com/t/issue-with-gemini-2-0-flash-exp-model-returning-an-error/4171/2 "2025-03-01T12:23:35Z")

</div>

> [@Alan\_Costa](#):
>
> ```auto
> in _get_llm_response
> raise ValueError("Invalid response from LLM call - None or empty.")
> ValueError: Invalid response from LLM call - None or empty.
> 
> ```

- Have you tried rerunning your Python script a few times? Does it always happen?
- Have you tried waiting, let’s say 30 seconds? Does it get solved automatically?

---

<div class="post-metadata">

**Author:** ![marcelomar21](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/marcelomar21/32/3104_2.png) [@marcelomar21](https://community.crewai.com/u/marcelomar21)\
**Post date:** [March 18, 2025, 7:04pm UTC](https://community.crewai.com/t/issue-with-gemini-2-0-flash-exp-model-returning-an-error/4171/3 "2025-03-18T19:04:30Z")

</div>

Hey @rokbenko, that happens to me too. Sometimes it works and sometimes it doesn’t. I’m using the Tier 1 Gemini API to get more RPM, but I’m still experiencing this problem. Do you have any suggestions on what we need to do?

---

<div class="post-metadata">

**Author:** ![maxmoura](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/maxmoura/32/4206_2.png) [@maxmoura](https://community.crewai.com/u/maxmoura)\
**Post date:** [March 18, 2025, 8:06pm UTC](https://community.crewai.com/t/issue-with-gemini-2-0-flash-exp-model-returning-an-error/4171/4 "2025-03-18T20:06:32Z")

</div>

I use the Gemini family of LLMs quite a bit, especially for tasks that don’t require specialization. I use them both through Vertex and OpenRouter. In both cases, I also see this issue. But it’s kind of hard to reproduce, since it doesn’t always happen.

However, at least in my case, it tends to happen in tasks that have an `output_pydantic` set. I haven’t dug into the code yet to try to debug where exactly the problem starts, but I have a hunch about how `output_pydantic` is passed. I can reduce the occurrences by reinforcing, in `expected_output`, the names of the keys used in the Pydantic model. Finally, I always set `max_iter=3` on agents that will perform tasks with structured output. This has allowed me to complete tasks, even if some error like this eventually pops up.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex025/uploads/crewai/original/1X/ecda97e72f77c7100e0a761444b1c991925cc789.png) [@system](https://community.crewai.com/u/system)\
**Post date:** [March 27, 2025, 12:14pm UTC](https://community.crewai.com/t/issue-with-gemini-2-0-flash-exp-model-returning-an-error/4171/5 "2025-03-27T12:14:33Z")

</div>

This topic was automatically closed after 30 days. New replies are no longer allowed.
