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

AI-generated summary

Frully reported a 500 Internal Server Error occurring specifically when using the ‘suggest topic title’ AI helper, while other AI features like proofreading and tag suggestions remained functional. The issue was identified on a self-hosted instance of v2026.10.0-latest +401 using Deepseek 3.2 via a DigitalOcean endpoint. The error logs indicated a NoMethodError: undefined method 'flatten' for an instance of String within the discourse-ai plugin’s assistant controller.

zogstrip confirmed the report and stated that the bug would be resolved by Pull Request #44697.

Related topics are similar but this seems new. All other related topics marked solved.

TLDR: 500 error when suggesting a topic title.
(proofread, generate markdown table, suggest tags, embedding, search/semantic all work fine)
Self hosted v2026.10.0-latest +401, Digitalocean droplet and serverless inference, Deepseek 3.2 via DO endpoint.

Logs generate error:

Failed to process hijacked response correctly : NoMethodError : undefined method 'flatten' for an instance of String
/var/www/discourse/plugins/discourse-ai/lib/ai_helper/assistant.rb:202:in 'DiscourseAi::AiHelper::Assistant#generate_and_send_prompt' 
/var/www/discourse/plugins/discourse-ai/app/controllers/discourse_ai/ai_helper/assistant_controller.rb:65:in 'block in DiscourseAi::AiHelper::AssistantController#suggest_title' 
/var/www/discourse/lib/hijack.rb:68:in 'BasicObject#instance_eval' 
/var/www/discourse/lib/hijack.rb:68:in 'block (2 levels) in Hijack#hijack' 
i18n-1.14.8/lib/i18n.rb:354:in 'I18n::Base#with_locale' 
/var/www/discourse/lib/hijack.rb:68:in 'block in Hijack#hijack' 
concurrent-ruby-1.3.8/lib/concurrent-ruby/concurrent/promises.rb:911:in 'Concurrent::Promises::Event#callback_on_resolution' 
concurrent-ruby-1.3.8/lib/concurrent-ruby/concurrent/promises.rb:797:in 'Concurrent::Promises::AbstractEventFuture#call_callback' 
concurrent-ruby-1.3.8/lib/concurrent-ruby/concurrent/promises.rb:803:in 'Concurrent::Promises::AbstractEventFuture#call_callbacks' 
concurrent-ruby-1.3.8/lib/concurrent-ruby/concurrent/promises.rb:692:in 'Concurrent::Promises::AbstractEventFuture#resolve_with' 
concurrent-ruby-1.3.8/lib/concurrent-ruby/concurrent/promises.rb:1331:in 'Concurrent::Promises::ResolvableEvent#resolve' 
/var/www/discourse/lib/scheduler/defer.rb:135:in 'block in Scheduler::Deferrable#do_work' 
rails_multisite-9.0.0/lib/rails_multisite/connection_management/null_instance.rb:54:in 'RailsMultisite::ConnectionManagement::NullInstance#with_connection'
rails_multisite-9.0.0/lib/rails_multisite/connection_management.rb:23:in 'RailsMultisite::ConnectionManagement.with_connection'
/var/www/discourse/lib/scheduler/defer.rb:130:in 'Scheduler::Deferrable#do_work' 
/var/www/discourse/lib/scheduler/defer.rb:116:in 'block (2 levels) in Scheduler::Deferrable#start_thread' 

Let me know if there is any more info I can add.

thanks for the report @Frully :+1: will be fixed by

1 Like