Site Search not working (DEBUG NOTICE: URL looks invalid and is discarded)

Hey there! I have a problem with the Site Search feature. I am tracking site searches using this:

window._paq?.push([
  "trackSiteSearch",
  // Search keyword searched for
  "What's the answer?",
  // Search category selected in your search engine. If you do not need this, set to false
  "Universal knowledge",
  // Number of results on the Search results page. Zero indicates a 'No Result Search Keyword'. Set to false if you don't know
  42,
]);

When I go to the Real-Time widget, I can see the search requests being tracked (little magnifying glass)…but if I then check the site search section, it’s empty:

I have no errors in my console, the script runs smoothly. But after activating the debug log in config.ini.php:

[Tracker]
debug = 1

…I can see some suspicious output from matomo.php. Here’s the relevant part:

[2023-04-06 10:45:58] piwik.DEBUG: Detected Site Search keyword '230'.  [] {"class":"Actions","request_id":"5dde9"}

[2023-04-06 10:45:58] piwik.DEBUG: - Detected Site Search Category 'Projects'.  [] {"class":"Actions","request_id":"5dde9"}

[2023-04-06 10:45:58] piwik.DEBUG: - Search Results Count was '1'.  [] {"class":"Actions","request_id":"5dde9"}

[2023-04-06 10:45:58] piwik.DEBUG: NOTE: The Page URL was changed / removed, during the Site Search detection, was 'https://www.example.com/projects/?find=230', now is '' [] {"class":"Actions","request_id":"5dde9"}

[2023-04-06 10:45:58] piwik.DEBUG: Detected Site Search keyword '230'.  [] {"class":"Actions","request_id":"5dde9"}

[2023-04-06 10:45:58] piwik.DEBUG: - Detected Site Search Category 'Projects'.  [] {"class":"Actions","request_id":"5dde9"}

[2023-04-06 10:45:58] piwik.DEBUG: - Search Results Count was '1'.  [] {"class":"Actions","request_id":"5dde9"}

[2023-04-06 10:45:58] piwik.DEBUG: NOTE: The Page URL was changed / removed, during the Site Search detection, was 'https://www.example.com/projects/?find=230', now is '' [] {"class":"Actions","request_id":"5dde9"}

[2023-04-06 10:45:58] piwik.DEBUG: WARNING: URL looks invalid and is discarded [] {"class":"Actions","request_id":"5dde9"}

[2023-04-06 10:45:58] piwik.DEBUG: Excluding parameters "ignore_referrer,ignore_referer,gclid,fbclid,msclkid,yclid,fb_xd_fragment,fb_comment_id,phpsessid,jsessionid,sessionid,aspsessionid,doing_wp_cron,sid,pk_vid,pk_cpn,pk_campaign,piwik_campaign,mtm_campaign,matomo_campaign,utm_campaign,utm_source,utm_medium,pk_kwd,pk_keyword,piwik_kwd,mtm_kwd,mtm_keyword,matomo_kwd,utm_term" from URL [] {"class":"Actions","request_id":"5dde9"}

[2023-04-06 10:45:58] piwik.DEBUG: WARNING: URL looks invalid and is discarded [] {"class":"Actions","request_id":"5dde9"}

So something seems to be off with the URL? Out of privacy reasons I have redacted the log to use example.com. I’m positive that it’s the same URL I’m using for normal page views.

Any idea?