Skip to content

Gemini can't understand/interpret JSON documents. Getting a 500 Server Error #1480

@Kamal-Moha

Description

@Kamal-Moha

I'm trying to have gemini model summarize/interpret a JSON document, but I'm getting a 500 server error from gemini.

Here is my code

from google import genai
from google.genai import types
import httpx
client = genai.Client()

doc_url = "https://storage.googleapis.com/kamal-test/transcript_playground-27pj-NR8y_2025487_091155.json"

# Retrieve and encode the PDF byte
doc_data = httpx.get(doc_url).content

prompt = "Summarize this document"
response = client.models.generate_content(
  model="gemini-2.5-flash",
  contents=[
      types.Part.from_bytes(
        data=doc_data,
        mime_type='application/json',
      ),
      prompt])
print(response.text)

I get

ServerError: 500 INTERNAL. {'error': {'code': 500, 'message': 'An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting', 'status': 'INTERNAL'}}

Most other models like OpenAI are able to interpret JSON documents without any issue.

Metadata

Metadata

Assignees

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions