Tag search returns 500 under some circumstances
meta:291242 (and another reproducer Also https://electrical.codidact.com/posts/291745
Not fully characterized.
Searching for a tag that doesn't exist (the EE report) or for a substring of a tag that does exist can produce 500 errors from the server. We made a fix (that I can't find now) after the initial meta report but it did not fix the whole problem. This needs more investigation.
Another case: https://meta.codidact.com/posts/292574
I triggered this in a dev environment and got the following complaint. The console highlighted the call to will_paginate as where the problem occurred. This is the same pagination function used elsewhere in the code (only the argument is different). Also note that we are within the scope of an "unless nil" block:
uwsgi-1 | ActionView::Template::Error (undefined method `total_pages' for #<ActiveRecord::AssociationRelation []>):
uwsgi-1 | 53: <% end %>
uwsgi-1 | 54: <% end %>
uwsgi-1 | 55:
uwsgi-1 | 56: <%= will_paginate @tags, renderer: BootstrapPagination::Rails %>
uwsgi-1 | 57:
uwsgi-1 | 58: <% end %> <%# unless @tags == nil %>
uwsgi-1 | 59:
uwsgi-1 |
uwsgi-1 | app/views/tags/category.html.erb:56
uwsgi-1 | app/models/application_record.rb:53:in `block in with_lax_group_rules'
uwsgi-1 | app/models/application_record.rb:49:in `with_lax_group_rules'
uwsgi-1 | app/views/tags/category.html.erb:5