Critical 429 Too Many Requests Error during image generation phase

Author: Badreddine-771Created Jun 1, 2026Updated Jun 6, 2026

Description

When running the script to generate YouTube Shorts, the image generation phase consistently fails and throws a 429 Client Error: Too Many Requests when attempting to call the Nano Banana 2 API (gemini-3.1-flash-image-preview).

Because there is no internal handling for this rate limit, the script fails to download any images, which subsequently breaks the video combination pipeline.

Steps to Reproduce

  1. Configure config.json with nanobanana2_model set to "gemini-3.1-flash-image-preview".
  2. Run python src/main.py and choose to generate a Short.
  3. If the script generates a high number of image prompts, the console immediately spams 429 Client Error: Too Many Requests for almost every image request.

Expected Behavior

The script should be able to handle API rate limits gracefully without crashing the entire video generation process or leaving the project with 0 downloaded images.

Source: FujiwaraChoki/MoneyPrinterV2