Registry panics with nil pointer dereference on GET /gitlab/v1/repositories/.../tags/list/
:information_source: The nil-pointer panic reported here is one of the symptoms enumerated in [`!2877`](https://gitlab.com/gitlab-org/container-registry/-/merge_requests/2877). Please see that issue for more details.
---------------------
The container registry panics with a runtime error: invalid memory address or nil pointer dereference on every request to list tags for a specific repository via the GitLab API endpoint (GET /gitlab/v1/repositories/<namespace>/<repo>/tags/list/). The request is authenticated and authorized successfully, but the handler crashes before returning a response. The connection is dropped with HTTP status 0 and 0 written bytes.
Steps to reproduce
1. Have a repository whose tag list is requested via the GitLab-internal registry API
2. Send: GET /gitlab/v1/repositories/<namespace>/<repo>/tags/list/?n=1
User-Agent: GitLab/19.0.0
3. The registry authorizes the request successfully
4. The registry panics — no response is returned to the client
Expected behavior
The endpoint returns a valid response (200 with tag list, or a graceful 404/500 with a JSON error body). A nil pointer in the handler should never result in a panic that drops the connection.
Actual behavior
The registry panics with the following error, logged at level=panic, and the HTTP connection is dropped (status 0, written_bytes 0):
runtime error: invalid memory address or nil pointer dereference
goroutine [running]:
github.com/docker/distribution/registry/handlers.(*repositoryTagsHandler).HandleGetTags(...)
.../registry/handlers/repositories.go:524 +0x41b
Environment
GitLab version: 19.0.0
Registry version: v4.40.0-gitlab
Go version: go1.25.7
Deployment: Omnibus (production)
Relevant log excerpt
level=info msg="authorized request"
auth_project_paths="[<namespace>/<repo>]"
auth_user_name= auth_user_type=
correlation_id=<redacted>
level=panic msg="runtime error: invalid memory address or nil pointer dereference"
stack="...
handlers.(*repositoryTagsHandler).HandleGetTags(0xc00007ce00, ...)
.../registry/handlers/repositories.go:524 +0x41b
..."
{"status":0,"written_bytes":0,"uri":"/gitlab/v1/repositories/<namespace>/<repo>/tags/list/?n=1"}
issue