Unsupported language when certain names are present

Hello everyone,
I am classifying bacteria, fungi, etc; which usually have scientific names in latin, my input looks like this:

{
    "1":"Fungi, specifically Ophiostoma minus",
    "2":"Penicillium aurantiogriseum",
    "3":"Penicillium digitatum",
    "4":"Pericornia byssoides (fungi)"
}

And my expected output like this:

{
  "Ophiostoma minus":{
    "1":"Fungi, specifically Ophiostoma minus"
  },
  "Penicillium":{
    "2":"Penicillium aurantiogriseum",
    "3":"Penicillium digitatum"
  },
  "Pericornia byssoides":{
    "4":"Pericornia byssoides (fungi)"
  },
}

Using a system prompt and chat history I have successfully done this for thousands of them, but certain names make the call fail, some examples are:

  • “Vibrio splendidus (bacteria)”
  • “Helminthosporium victoriae (fungus)”
  • “Penicillium aurantiogriseum”

If I use the API with the Python module I get this error:

google.generativeai.types.generation_types.StopCandidateException: index: 0
finish_reason: 6

Which is not listed in generative-ai-python/google/generativeai/types/answer_types.py at f08c789741f30e49ecfb822540fd749920d62bcc · google-gemini/generative-ai-python · GitHub
But using AI Studio this error is displayed:

Is there any way to avoid this error?
Is it possible to fix this by modifying the system prompt or model configuration?
Thank you!