TypeError: no implicit conversion of nil into String in changelog generation

Issue Description

TypeError: no implicit conversion of nil into String in changelog generation

The changelog generation API endpoint fails with a TypeError when attempting to match a nil value against a regular expression in the UntrustedRegexp#match method.

Root Cause

The error occurs in the changelog tag finder when:

  1. A user calls the /repository/changelog API endpoint
  2. The ChangelogService attempts to find the start of the commit range using ChangelogTagFinder
  3. The tag finder tries to match a nil text value against a regex pattern in UntrustedRegexp#match

Stack Trace

TypeError: no implicit conversion of nil into String (TypeError)

      scan_regexp.match(text)
                        ^^^^
  from lib/gitlab/untrusted_regexp.rb:74:in `match'
  from lib/gitlab/untrusted_regexp.rb:74:in `match'
  from app/finders/repositories/changelog_tag_finder.rb:47:in `execute'
  from app/services/repositories/changelog_service.rb:138:in `start_of_commit_range'
  from app/services/repositories/changelog_service.rb:88:in `execute'
  from lib/api/repositories.rb:350:in `block (2 levels) in <class:Repositories>'

Stack Trace Flow

  1. API call to lib/api/repositories.rb:350 (changelog endpoint)
  2. ChangelogService#execute calls start_of_commit_range
  3. ChangelogTagFinder#execute attempts to match version strings
  4. UntrustedRegexp#match receives nil instead of a string
  5. Ruby's RE2::Regexp#match method fails with implicit conversion error

Impact

  • Changelog generation fails completely when version strings are nil
  • API returns 500 error instead of graceful handling
  • Affects automated release workflows that depend on changelog generation

Expected Behavior

The system should handle nil values gracefully by either:

  • Validating input parameters before regex matching
  • Providing clear error messages for invalid version formats
  • Skipping nil values during tag processing

This appears to be a missing null check in the regex matching logic within the changelog tag finder functionality.

Edited by 🤖 GitLab Bot 🤖