Skip to content

diffs_metatdata Returning 500 Error - nil can't be coerced into Integer

Error Budget

As the Code Review team, we are over our Error Budget. As we get requests that fail, we "use" some of our allotment of error budget. If we use too many minutes, then we are beyond our error budget.

Kibana Logs

I was looking at the Kibana Rails failed request logs. These are requests where the JSON response code is 500.

Currently, about 40% of the errors come from one request, Projects::MergeRequests::DiffsController#diffs_metadata. Over 99% of these are returning the error message:

nil can't be coerced into Integer

Based on my Kibana search, this error is occurring about 1000 times each day. This currently accounts for about 1/3 of the JSON 500 errors we are returning.

We should check for this case and not return a 500 error.

Edited by Matt Nohr