After updating to Discourse 3.1.0.beta1, kinetiksoft reported that search functionality broke, returning a 500 error with “wrong number of arguments (given 1, expected 0)” in lib/search.rb. The issue persisted even in Safe Mode. While search worked for Categories/Tags and Users, it failed for Topics/Posts kinetiksoft. Investigation revealed two contributing factors: (1) use of PostgreSQL 14.6-1, which Falco confirmed breaks search in subtle ways (Discourse officially supports PostgreSQL 13 only); and (2) the Discourse Private Replies plugin, which triggered the server error due to Ruby 3.1 incompatibility Benjamin_D, david. Removing the plugin restored basic search functionality kinetiksoft, though PostgreSQL 14 remains unsupported. Stephen emphasized that PostgreSQL 14 compatibility is not supported, regardless of prior working state. kinetiksoft requested clearer documentation warnings about PostgreSQL version requirements, noting the official install guide on GitHub only mentions “Postgres 13+” without specifying incompatibility with 14+. Stephen directed users to Meta documentation for external PostgreSQL setup. The plugin author RGJ confirmed and fixed the Ruby 3.1 incompatibility. kinetiksoft suggested deprecating outdated documentation to avoid confusion. The team plans to downgrade PostgreSQL next week for full compatibility.
Since our 3.1.0 update today, our Search is no longer working.
Our sysadmin team identified a problem and provided us with this log stating this is an application error.
Does anyone else experience this problem and what may the clues be for us to be able to resolve the problem ourselves? I see search works perfectly at Discourse Meta.
Started GET "/search?q=37%20%20realm&page=1" for [IP_REDACTED] at 2023-01-13 11:19:36 +0000
Processing by SearchController#show as JSON
Parameters: {"q"=>"37 realm", "page"=>"1"}
Completed 500 Internal Server Error in 4ms (ActiveRecord: 0.0ms | Allocations: 1555)
ArgumentError (wrong number of arguments (given 1, expected 0))
lib/search.rb:285:in `execute'
app/controllers/search_controller.rb:73:in `show'
app/controllers/application_controller.rb:414:in `block in with_resolved_locale'
app/controllers/application_controller.rb:414:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:366:in `call'
config/initializers/008-rack-cors.rb:24:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:228:in `call'
Failed to handle exception in exception app middleware : ArgumentError : wrong number of arguments (given 1, expected 0)
Our search is completely broken when running against PostgreSQL 14, which is why we are still shipping PostgreSQL 13 for everyone following our standard install.
We will eventually fix it since we will upgrade to PostgreSQL 15 (or 16) someday, but it may take a while.
Thank you. We’re investigating how that may have happened IF we have previously had other PostgreSQL version. Will get back to you once we identify the issue.
We see “Postgres 13+” requirement here. May I be wrong by suggesting to your team to add a notice that Discourse supports 13.X versions only? Maybe, explicit notice of 14/15/… versions are not supported would be helpful too in such cases like ours.
You see, we had Version 14 for at least since December, and we had Stable version of Discourse installed since months earlier. Recently we moved back to tests-passed version, searched worked as expected. Today, we updated from 2.9.0.beta14 to 3.1.0.beta1 and now it’s broken.
Unclear, but that was the issue in my case (same symptoms - although with PostgreSQL13)
I’m sure Richard will patch it up shortly, in the mean time a fork and a simple edit is a solution.
Safe mode only impacts the client-side. This error is happening on the server. To check whether the error is related to the private replies plugin, you’ll need to uninstall that plugin completely.
This error does seem likely to be related to a Ruby 3.1 plugin incompatibility
That plugin does break search and will trigger the error 500.
But running PostgreSQL 14+ will also break search, but in a more subtly way where a lot of results that would be returned on pg13 won’t return on pg14+.
So @kinetiksoft can remove the plugin and rebuild to get search to not error out, but it won’t work normally still because of pg version.
Did you check the documentation on running external PostgreSQL? It’s here on Meta, not github. All of the documentation is visible at Documentation - Discourse Meta