Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

ai-gemini: native image generation throws "returned no id" when modelOptions.store is false

Abierto
#1,915 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@pcbeingused333 ya está trabajando en esto.

Desde el 28/10/2026.

  • #1928 de @pcbeingused333 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
57/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript

Línea de trabajo

Start with packages/ai-gemini/src/adapters/image.ts, especially transformInteractionResponse and the unconditional missing-ID check described in the issue. Check how store reaches that function and review the result type and tests for native Gemini image generation. Done means store: false returns the generated image without an ID, while stored interactions still require one; add or update coverage for both cases.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

TanStack AI version

@tanstack/ai 1.0.0, @tanstack/ai-gemini 1.0.0

Framework/Library version

Server-side only, no UI framework: Bun 1.4.4

Describe the bug and the steps to reproduce it

@tanstack/ai-gemini accepts store on native image model options and forwards it to the Interactions API. With store: false, Gemini does not store the interaction and returns it without an id. The adapter then throws on every call, even though it generated the image:

Error: Gemini gemini-nano-banana-2.1 image interaction returned no id.

The throw is the unconditional check in transformInteractionResponse (packages/ai-gemini/src/adapters/image.ts, line 271 on main today):

if (!interaction.id) throw new Error(`Gemini ${model} image interaction returned no id.`)

The id is only needed to chain an edit through previous_interaction_id. #1655 already notes that store: false cannot chain, so an unstored interaction has no use for one. As a result, store: false can never succeed, and image generation cannot opt out of the Interactions API's default retention (55 days on the paid tier).

Steps:

  1. Call generateImage with a native Gemini image adapter and modelOptions: { store: false } (script below).
  2. It throws image interaction returned no id.
  3. Remove store: false and it returns an image.

Expected: with store: false, the call returns the image, and result.id is undefined (or the field is left out).

A possible fix: require the id only when the request was stored, for example if (!interaction.id && modelOptions?.store !== false) throw …. That would also mean making id optional on the result type for this case.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://gist.github.com/developer-nichemarketing/b6aef25ddc4c41da7b6371a71ee85c55

Run with GEMINI_API_KEY=… bun repro.ts (or npx tsx repro.ts). The script:

import { generateImage } from "@tanstack/ai";
import { createGeminiImage } from "@tanstack/ai-gemini";

const adapter = createGeminiImage("gemini-nano-banana-2.1", process.env.GEMINI_API_KEY!);

// Works: returns an image and an interaction id.
const stored = await generateImage({ adapter, prompt: "A red apple on a white table", size: "1:1_1K" });
console.log("stored:", stored.id, stored.images.length);

// Throws: "Gemini gemini-nano-banana-2.1 image interaction returned no id."
const unstored = await generateImage({
  adapter,
  prompt: "A red apple on a white table",
  size: "1:1_1K",
  modelOptions: { store: false },
});
console.log("unstored:", unstored.images.length);
Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

Yes, I think I know how to fix it and will discuss it in the comments of this issue

Terms & Code of Conduct
  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Lenguaje dominante
TypeScript
Estrellas
3.2k
Forks
372
Merge medio
1 d 9 h
PR fusionados (30 d)
229

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TanStack/ai

Todos los issues de TanStack/ai

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.