Skip to content

NoMethodError: zoekt_nodes is null in some instances

Summary

Some zoekt searches end up with empty zoekt_nodes which results in an unhandled exception

Steps to reproduce

Unknown

What is the current bug behavior?

unhandled exception

What is the expected correct behavior?

search results are returned or a generic error message

Relevant logs and/or screenshots

this is occurring in both count and show methods for the SearchController

https://new-sentry.gitlab.net/organizations/gitlab/issues/1411725/?alert_rule_id=13&alert_type=issue&environment=gprd&notification_uuid=adc0f4e3-1807-4892-a681-151e9fa9fee3&project=3

undefined method `id' for nil:NilClass (NoMethodError)

      @zoekt_node_id ||= zoekt_nodes.first.id
                                          ^^^

Possible fixes