Component search: first search always fails with AttributeError on _dataform_widget
Summary
The first search against any XEP-0055 capable service always fails and the assistant stays stuck on "Requesting search form from server". The search form arrives from the server, but rendering it raises before the form page is shown.
Environment
- Gajim 2.7.0 (Arch package gajim 2.7.0-1)
- python-nbxmpp 7.5.0
- Python 3.14.10
- GTK 4
- Server: ejabberd 26.9.0, mod_vcard search component (
vjud.example.org)
Steps to reproduce
- Open Actions > Discover Services (Ctrl+D).
- Select any service that supports
jabber:iq:search(for example an ejabberdvjudcomponent). - Click Search.
- The window shows "Requesting search form from server" and never advances.
Expected
The search form is rendered.
Actual
The following traceback is printed and the window stays on the progress page:
2026-11-16 12:13:28 (E) nbxmpp.dispatcher (account) Error while handling stanza
Traceback (most recent call last):
File "nbxmpp/dispatcher.py", line 703, in dispatch
func(self._client, stanza, **user_data)
File "nbxmpp/task.py", line 365, in _async_finished
self._next_step(result)
File "nbxmpp/task.py", line 230, in _next_step
self._set_finished()
File "nbxmpp/task.py", line 234, in _set_finished
self._invoke_callbacks()
File "nbxmpp/task.py", line 263, in _invoke_callbacks
callback(self)
File "gajim/gtk/util/misc.py", line 146, in func_wrapper
return func(self, *args, **kwargs)
File "gajim/gtk/component_search.py", line 115, in _search_form_received
self.get_page("form").process_search_form(form)
File "gajim/gtk/component_search.py", line 157, in process_search_form
self.clear()
File "gajim/gtk/component_search.py", line 154, in clear
self.remove(self._dataform_widget)
AttributeError: 'SearchForm' object has no attribute '_dataform_widget'Cause
SearchForm.clear() removes self._dataform_widget, but SearchForm.__init__ never defines that attribute. process_search_form() calls clear() before the widget is created, so the first call always raises and show_page("form") is never reached. Every later search works because by then the attribute exists.
Suggested fix
Initialize the attribute or guard the removal, for example:
def clear(self) -> None:
widget = getattr(self, "_dataform_widget", None)
if widget is not None:
self.remove(widget)
self._dataform_widget = NoneWith that change the form renders correctly. I verified it locally by applying the same patch.