Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JS] unhandled error when generating an image with some prompts again imagen3Fast with vertexAI #2244

Open
hoff opened this issue Mar 5, 2025 · 0 comments
Labels
bug Something isn't working js

Comments

@hoff
Copy link

hoff commented Mar 5, 2025

Describe the bug
I encounter an unhandled error with some prompts when trying to generate an image. Here is the stack trace:

TypeError: Cannot read properties of undefined (reading 'map') at file:///Users/USERNAME/code/codezero/codezero-deno/node_modules/.deno/@genkit-ai+vertexai@1.0.5/node_modules/@genkit-ai/vertexai/lib/imagen.js:200:47 at Object.runMicrotasks (ext:core/01_core.js:683:26) at processTicksAndRejections (ext:deno_node/_next_tick.ts:59:10) at runNextTicks (ext:deno_node/_next_tick.ts:76:3) at eventLoopTick (ext:core/01_core.js:182:21) at async file:///Users/USERNAME/code/codezero/codezero-deno/node_modules/.deno/@genkit-ai+core@1.0.5/node_modules/@genkit-ai/core/lib/action.js:204:14 at async file:///Users/USERNAME/code/codezero/codezero-deno/node_modules/.deno/@genkit-ai+core@1.0.5/node_modules/@genkit-ai/core/lib/action.js:125:27 at async file:///Users/USERNAME/code/codezero/codezero-deno/node_modules/.deno/@genkit-ai+core@1.0.5/node_modules/@genkit-ai/core/lib/tracing/instrumentation.js:65:16 at async file:///Users/USERNAME/code/codezero/codezero-deno/node_modules/.deno/@genkit-ai+core@1.0.5/node_modules/@genkit-ai/core/lib/tracing/instrumentation.js:88:24 at async runInNewSpan (file:///Users/USERNAME/code/codezero/codezero-deno/node_modules/.deno/@genkit-ai+core@1.0.5/node_modules/@genkit-ai/core/lib/tracing/instrumentation.js:77:10)"

To Reproduce
I followed the sample code on https://firebase.google.com/docs/genkit/models#generating-media, here is the code to reproduce the error:

`const ai = genkit({
plugins: [
googleAI({ apiKey: 'XXX' }),
vertexAI({ location: 'us-central1', projectId: 'PROJECT_NAME'}),
],
model: gemini20Flash,
})

const response = await ai.generate({
model: imagen3Fast,
prompt: 'a coach',
output: { format: 'media' },
})

`

Expected behavior
I expect either the image to be generated, or an error message explaining what the error is.

Runtime (please complete the following information):

  • OS: MacOS
  • Version 11.7.10

** Node version

  • v20.17.0

Additional context
When using a 'bad' word in the prompt, I do get a proper error message: "Image generation failed with the following error: The prompt could not be submitted. Your current safety filter threshold prohibited one or more words in this prompt. If you think this was an error, send feedback. Support codes: 78610348, 32635315"

Some prompt work perfectly fine, like "a cat playing piano", but some prompt trigger the error described, innocent prompts like "a coach" or "a yoga pose".

@hoff hoff added bug Something isn't working js labels Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working js
Projects
Status: No status
Development

No branches or pull requests

1 participant