# Getting 400 INVALID\_ARGUMENT Intermittently

**URL:** <https://discuss.ai.google.dev/t/getting-400-invalid-argument-intermittently/122930>\
**Category:** Gemini API\
**Tags:** python, gemini-api, genai, python-library\
**Created:** [February 13, 2026, 2:05pm UTC](https://discuss.ai.google.dev/t/getting-400-invalid-argument-intermittently/122930 "2026-02-13T14:05:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fnatic9910](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/fnatic9910/32/93043_2.png) [@fnatic9910](https://discuss.ai.google.dev/u/fnatic9910)\
**Post date:** [February 13, 2026, 2:05pm UTC](https://discuss.ai.google.dev/t/getting-400-invalid-argument-intermittently/122930/1 "2026-02-13T14:05:49Z")

</div>

Error:

```auto
google.genai.errors.ClientError: 400 INVALID_ARGUMENT. {‘error’: {‘code’: 400, ‘message’: ‘Request contains an invalid argument.’, ‘status’: ‘INVALID_ARGUMENT’}}
at google/genai/errors.py:210 (raise_error_async)
at google/genai/errors.py:188 (raise_for_async_response)
at google/genai/_api_client.py:1312 (_async_request_once)
at tenacity/asyncio/init.py:116 (call)
at concurrent/futures/_base.py:401 (get_result)
at concurrent/futures/_base.py:449 (result)
at tenacity/init.py:184 (reraise)
at tenacity/init.py:413 (exc_check)
at tenacity/_utils.py:111 (inner)
at tenacity/asyncio/init.py:157 (iter)
at tenacity/asyncio/init.py:112 (call)
at google/genai/_api_client.py:1367 (_async_request)
at google/genai/_api_client.py:1434 (async_request)
at google/genai/models.py:5839 (_generate_content)
at google/genai/models.py:7033 (generate_content)
at app/services/gemini_service.py:264 (_call_gemini_api_with_config)
at app/utils/retry_utils.py:84 (retry_with_backoff)
at app/utils/retry_utils.py:89 (retry_with_backoff)
at app/utils/retry_utils.py:112 (wrapper)
at app/services/gemini_service.py:277 (_call_gemini_api_with_rotation)
at app/services/gemini_service.py:104 (generate_images_async)
at app/services/gemini_service.py:163 (generate_images_async) # re-raise
at app/tracing/wrappers.py:53 (async_wrapper)
at app/worker.py:257 (_process_task_internal)
at app/worker.py:195 (process_task_async)
at app/worker.py:349 (run_job)

```

This was intermittent and failed for a while with the same inputs, then started working again without any changes on our side.

One thing I realized is that we’re sending **MPO images** but setting the MIME type to **image/jpeg**. That said, we’ve successfully generated thousands of images with Gemini using MPO inputs labeled as JPEG, so this hasn’t been an issue before.

I’m wondering if there’s anything we can do on our end to make this more reliable or avoid this kind of intermittent `INVALID_ARGUMENT` error going forward.

---

<div class="post-metadata">

**Author:** ![Benito\_J\_D](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/benito_j_d/32/93067_2.png) [@Benito\_J\_D](https://discuss.ai.google.dev/u/Benito_J_D)\
**Post date:** [February 13, 2026, 2:09pm UTC](https://discuss.ai.google.dev/t/getting-400-invalid-argument-intermittently/122930/2 "2026-02-13T14:09:20Z")

</div>

I am also facing the same issue. Need a fix asap we are losing trust with our customer guys

---

<div class="post-metadata">

**Author:** ![Logan\_Kilpatrick](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/logan_kilpatrick/32/129_2.png) [@Logan\_Kilpatrick](https://discuss.ai.google.dev/u/Logan_Kilpatrick)\
**Post date:** [February 13, 2026, 5:17pm UTC](https://discuss.ai.google.dev/t/getting-400-invalid-argument-intermittently/122930/3 "2026-02-13T17:17:47Z")

</div>

Flagged to the team, looking into this!

---

<div class="post-metadata">

**Author:** ![Rolands\_Kundzins](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/rolands_kundzins/32/93021_2.png) [@Rolands\_Kundzins](https://discuss.ai.google.dev/u/Rolands_Kundzins)\
**Post date:** [February 17, 2026, 6:15am UTC](https://discuss.ai.google.dev/t/getting-400-invalid-argument-intermittently/122930/4 "2026-02-17T06:15:20Z")

</div>

I am also starting to get this issue in the past two days.

---

<div class="post-metadata">

**Author:** ![abbm](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/abbm/32/31627_2.png) [@abbm](https://discuss.ai.google.dev/u/abbm)\
**Post date:** [February 17, 2026, 10:49pm UTC](https://discuss.ai.google.dev/t/getting-400-invalid-argument-intermittently/122930/5 "2026-02-17T22:49:18Z")

</div>

We’re seeing a similar thing, in the nodejs `geminiClient.files.upload()` function. Intermittent 400 errors with INVALID\_ARGUMENT. Retrying the request with the exact same data succeeds 95% of the time (remaining 5% need to be retried twice).

This is in a production app that’s been uploading thousands of files a month since November 25 without issue. These 400 errors started appearing about 24 hours ago for us.
