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:
- A user calls the
/repository/changelogAPI endpoint - The
ChangelogServiceattempts to find the start of the commit range usingChangelogTagFinder - The tag finder tries to match a
niltext value against a regex pattern inUntrustedRegexp#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
- API call to
lib/api/repositories.rb:350(changelog endpoint) -
ChangelogService#executecallsstart_of_commit_range -
ChangelogTagFinder#executeattempts to match version strings -
UntrustedRegexp#matchreceivesnilinstead of a string - Ruby's
RE2::Regexp#matchmethod 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
nilvalues 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 🤖