subgroups can not be created because of namespace conflicts

Summary

It is not possible to create a subgroup with the name 001 at our installation. From the logfiles I gather that it validates against a uniqueness and we have indeed a 001 subgroup but in a different namespace/group, the new name would be unique.

Steps to reproduce

curl -H 'PRIVATE-TOKEN: xxx' -d '{"name": "Test Project", "path": "001", "visibility_level": "private", "parent_id": xxx, "description": "Test"}' -H "Content-Type: application/json" -X POST …/api/v4/groups

This results in:

{"message":"500 Internal Server Error"}

The log shows:


ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "namespaces_path"
DETAIL:  Key (path)=(001) already exists.
: INSERT INTO "namespaces" ("type", "name", "path", "visibility_level", "parent_id", "created_at", "updated_at", "description_html", "cached_markdown_version") VALUES ('Group', 'Test', '001', 0, 420, '2018-11-26 12:45:52.619928', '2018-11-26 12:45:52.619928', '', 11) RETURNING "id"):
  config/initializers/active_record_locking.rb:11:in `_create_record'
  app/services/groups/create_service.rb:32:in `execute'
  ee/app/services/ee/groups/create_service.rb:8:in `execute'
  app/controllers/groups_controller.rb:40:in `create'
  lib/gitlab/i18n.rb:55:in `with_locale'
  lib/gitlab/i18n.rb:61:in `with_user_locale'
  app/controllers/application_controller.rb:434:in `set_locale'
  lib/gitlab/middleware/multipart.rb:101:in `call'
  lib/gitlab/request_profiler/middleware.rb:14:in `call'
  ee/lib/gitlab/jira/middleware.rb:15:in `call'
  lib/gitlab/middleware/go.rb:17:in `call'
  lib/gitlab/etag_caching/middleware.rb:11:in `call'
  lib/gitlab/middleware/read_only/controller.rb:40:in `call'
  lib/gitlab/middleware/read_only.rb:16:in `call'
  lib/gitlab/middleware/basic_health_check.rb:25:in `call'
  lib/gitlab/request_context.rb:20:in `call'
  lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
  lib/gitlab/middleware/release_env.rb:10:in `call'

What is the current bug behavior?

API shows:

{"message":"500 Internal Server Error"}

What is the expected correct behavior?

Subgroup 001 is created

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Ubuntu 16.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.4.5p335 Gem Version: 2.7.6 Bundler Version:1.16.6 Rake Version: 12.3.1 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.1 Go Version: unknown

GitLab information Version: 11.5.0-ee Revision: cb71fca Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.6 URL: https://hpm.agency HTTP Clone URL: https://hpm.agency/some-group/some-project.git SSH Clone URL: git@hpm.agency:some-group/some-project.git Elasticsearch: no Geo: yes Geo node: Primary Using LDAP: no Using Omniauth: yes Omniauth Providers: google_oauth2

GitLab Shell Version: 8.4.1 Repository storage paths:

  • default: /gitlab-data/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check

Possible fixes

Edited Nov 26, 2018 by Mario
Assignee Loading
Time tracking Loading