Skip to content

CandidateCount > 1 returns 400 "Multiple candidates is not enabled for this model" on Gemini 3.x models (regression) #1609

@AmitTzah

Description

@AmitTzah

candidateCount worked fine on Gemini 2.x models but any value above 1 now returns a 400 error on all Gemini 3.x models I've tested, including the stable GA gemini-3.1-flash-lite. The parameter is still present and undeprecated in the SDK types, and there's been no changelog entry or announcement about this change.

Environment details

  • Programming language: TypeScript / JavaScript
  • OS: Windows 11
  • Language runtime version: Node.js v24.1.0
  • Package version: @google/genai 2.4.0

Steps to reproduce

  1. Run the following:
import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

const response = await ai.models.generateContent({
  model: "gemini-3.1-flash-lite",
  contents: "Give me a short poem about the sea.",
  config: {
    candidateCount: 2,
    temperature: 1.0,
  },
});

console.log(response.candidates);
  1. Returns:
{
  "error": {
    "code": 400,
    "message": "Multiple candidates is not enabled for this model",
    "status": "INVALID_ARGUMENT"
  }
}

Same code with gemini-2.5-flash works fine. Also reproduced on gemini-3-flash-preview and gemini-3.1-pro-preview.

Same behavior also reported in python-genai: googleapis/python-genai#1723

Metadata

Metadata

Assignees

Labels

api:gemini-apipriority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions