# 500 internal server error using 'suggest topic title' AI helper

**URL:** <https://meta.discourse.org/t/500-internal-server-error-using-suggest-topic-title-ai-helper/414790>\
**Category:** Bug\
**Created:** [October 15, 2026, 5:48pm UTC](https://meta.discourse.org/t/500-internal-server-error-using-suggest-topic-title-ai-helper/414790 "2026-10-15T17:48:19Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [October 16, 2026, 2:54pm UTC](https://meta.discourse.org/t/500-internal-server-error-using-suggest-topic-title-ai-helper/414790/3 "2026-10-16T14:54:51Z")

</div>

thanks for the report @Frully 👍 will be fixed by

> <https://github.com/discourse/discourse/pull/44697>
>
> Previously, title suggestions called \`flatten\` on whatever \`generate\_prompt\` ret…urned, assuming an Array. The shape actually depends on the agent picked in \`ai\_helper\_title\_suggestions\_agent\` (any agent is accepted, and one without an array response format replies with plain text) and on the provider honouring the schema. Any non-Array reply made \`suggest\_title\` fail with \`undefined method 'flatten' for an instance of String\`, surfaced as a generic 500 by the hijacked request.
> 
> This change normalizes the reply where a list is expected, keeping only non-blank string suggestions, so a reply that isn't a list shows "No suggestions available" instead of erroring. It also drops the array clean-up in \`generate\_prompt\`, which this now covers.
> 
> Reported in https://meta.discourse.org/t/414790

---

_[View the full topic](https://meta.discourse.org/t/500-internal-server-error-using-suggest-topic-title-ai-helper/414790)._
