Skip to content

[Bug] Extra inputs are not permitted error when using image_config in Batch API (Nano-Banana) #1106

@hans2356

Description

@hans2356

Description of the bug:

When using the google-genai Python SDK to submit a batch job for image generation (using the gemini-3-pro-image-preview model), the SDK throws a Pydantic validation error if image_config is included in the generation_config.

According to the official documentation and Google Colab examples, image_config (containing aspect_ratio and image_size) should be supported. However, the SDK's Pydantic model seems to reject these fields as "extra inputs".

Actual vs expected behavior:

Python

from google import genai

client = genai.Client(api_key='YOUR_API_KEY')

Basic inline request structure following the docs

inline_requests = [
{
"contents": [{
"parts": [
{"text": "Transform this image into pixel art."},
{"inline_data": {"mime_type": "image/jpeg", "data": "BASE64_DATA..."}}
],
}],
"generation_config": {
"response_modalities": ["IMAGE"],
"image_config": {
"aspect_ratio": "16:9",
"image_size": "2K"
}
}
}
]

client.batches.create(
model="models/gemini-3-pro-image-preview",
src=inline_requests,
config={'display_name': 'test-job'}
)
Expected behavior The batch job should be created successfully without validation errors, as image_config is a documented feature for the Nano-Banana model.

Actual behavior (Error Message)

Plaintext

ValidationError: 1 validation error for BatchJobSource
inlined_requests.0.generation_config
Extra inputs are not permitted [type=extra_forbidden, input_value={'response_modalities': ['IMAGE'], 'image_config': {'aspect_ratio': '16:9', 'image_size': '2K'}}, input_type=dict]

Any other information you'd like to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions