Error "no implicit conversion of Array into String" when using Gemini AI analysis on posts with images

AI-generated summary

Users hel_Sinki and Michael12 reported a bug in the Discourse AI plugin with Gemini integration: analyzing posts containing images triggers the error “no implicit conversion of Array into String.” Text-only posts work normally. hel_Sinki noted the issue occurs only with the default “creative” bot, while custom bots handle images correctly. sam requested configuration details and advised using non-preview Gemini models. hel_Sinki confirmed the issue was resolved after removing RAG (Retrieval-Augmented Generation) configuration. sam credited Roman for fixing the RAG-related bug and closed the issue. The problem appears tied to how image data is processed in combination with RAG settings, not the core image handling itself.

Hi everyone,

I’ve encountered an issue while using the Discourse AI plugin with Gemini integration. When I try to analyze posts that contain images, I get the following error message:

no implicit conversion of Array into String

What happens

  • If the post only contains text, everything works as expected.
  • If the post includes an image , the analysis fails with this error.

Environment

Installed 3.5.0.beta8-dev (70dbb95041)

Thanks for your help!

1 Like

When I include an image in a public post, Gemini returns no reply,

when I send it via private message, the AI reports the error shown above.

The same behavior occurs across multiple AI models.

Only the default “creative” bot produces the above error; other custom AI bot can successfully recognize the image and respond normally.

I’m running into the same issue. Text-only posts work fine, but if there’s an image in the post, I get the same “no implicit conversion of Array into String” error.

From the error message, it seems like something in the image data is confusing the plugin or Gemini. Maybe it’s sending the image info in a way that the API doesn’t expect.

Good to know it only happens with certain bots. Hopefully, this gets sorted out soon.

I am having trouble with a repro here, using creative with images enabled:

Can you share how your LLM is configured, be sure to use the non preview 2.0 / 2.5 flash model now that it is released.

Confirmed: after I removed the RAG configuration, the image‐analysis functionality returned to normal. Thanks for the help!

1 Like

@Roman fixed the RAG issues, so I assume we are all good now, thanks for reporting!

2 Likes