Bug Report - [400 Bad Request] Request contains an invalid argument

In AI Studio

Input:

 <context>
  {
"시작 단어": "백찛"
}
  </context>


  Just provide the answer. Above context informations are used only for inference.
  It is forbidden to include the context tag as is in the answer.
  Additional sentences other than the content of the answer are prohibited.
  </systemPrompt>


끝말잇기 게임의 고수가 되어주시겠어요?

제시된 단어로부터 시작하여 연속되는 단어들을 이어나가주세요.

게임은 단어가 반복되지 않고, 사전에 있는 실제 단어들을 사용할 때까지 계속 됩니다.

단어는 명사만을 사용해야 하며, 각 단어는 전 단어의 마지막 글자로 시작해야 합니다.

예시:

"사과 -> 과일 -> 일기예보 -> 보름달 -> 달팽이 -> ..."

필요 없는 내용은 생략하고 명료하게 써줘..

Screenshot:

Using API, I got an error log:

[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:streamGenerateContent?alt=sse: [400 Bad Request] Request contains an invalid argument.
...

Unhandled Rejection at: Promise Promise { <rejected> } reason: 234 |  * Basic error type for this SDK.
235 |  * @public
236 |  */
237 | class GoogleGenerativeAIError extends Error {
238 |     constructor(message) {
239 |         super(`[GoogleGenerativeAI Error]: ${message}`);
              ^
error: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:streamGenerateContent?alt=sse: [400 Bad Request] Request contains an invalid argument.
     status: 400,
 statusText: "Bad Request",
 errorDetails: undefined,

I think it happens when output result is too long.

Hi @lentil32 , Welcome to the forum.

With the 1.5 model, there seems to be an issue when we try to stream the output. Without streaming, it works fine.

Have you tried using gemini-2.0-flash-exp? It works with that model.

Hi @GUNAND_MAYANGLAMBAM . Thank you for checking, but i found that this happens to gemini-2.0-flash too.

After retrying it like 10~ times, i got the same error.