Skip to content

Special characters in project path causes ContainerRegistry::Path::InvalidRegistryPathError

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

https://sentry.gitlab.net/gitlab/gitlabcom/issues/616209/

ContainerRegistry::Path::InvalidRegistryPathError: ContainerRegistry::Path::InvalidRegistryPathError
  container_registry/path.rb:35:in `nodes'
    raise InvalidRegistryPathError unless valid?
  container_registry/path.rb:62:in `repository_project'
    .where_full_path_in(nodes.first(LEVELS_SUPPORTED))
  container_registry/path.rb:44:in `has_project?'
    repository_project.present?
  container_registry/path.rb:49:in `has_repository?'
    return false unless has_project?
  projects/registry/repositories_controller.rb:43:in `block in ensure_root_container_repository!'
    break if path.has_repository?
...
(132 additional frame(s) were not displayed)

ContainerRegistry::Path::InvalidRegistryPathError: ContainerRegistry::Path::InvalidRegistryPathError

Possible Workarounds

  1. Rename project to not have a _ in the project name.
  2. For groups or usernames, delete or transfer all projects, then rename the namespace.

Limitations

There is nothing we can do about supporting leading or trailing underscores in container repository paths. Repository paths must conform to the [a-z0-9]+([._-][a-z0-9]+)*(/[a-z0-9]+([._-][a-z0-9]+)*)* regexp defined upstream in the OCI Distribution specification (link).

Proposal

Prevent project's from being created with a leading underscore to ensure this error does not occur.

Edited by 🤖 GitLab Bot 🤖