Skip to content

gitlab-sync fails with 401 Unauthorized

Describe the bug

gitlab-sync fails with 401 Unauthorized. Running successfully the day before at 7th of Juni 2024.

Expected behavior

Successful synchronization of tbc templates.

Actual behavior

Fails immediately with 401.

Logs and/or screenshots

Synchronizing GitLab group
- source API  (--src-api)        : https://gitlab.com/api/v4
- src path    (--src-sync-path)  : to-be-continuous
- dest API    (--dest-api)       : https://gitlab.company/api/v4
- dest path   (--dest-sync-path) : to-be-continuous
- max visi.   (--max-visibility) : internal
- skip visi  (--skip-visibility) : False
- exclude     (--exclude(-from)) : samples, custom
- include     (--include(-from)) : 
- insecure    (--insecure)       : False
- upd release (--update-release) : False
- upd. avatar (--update-avatar)  : False
- dry run     (--dry-run)        : False
- halt on err. (--halt-on-error) : False
- cache dir   (--cache-dir)      : .work
- new group options (--new-group-options)       : {}
- new project options (--new-project-options)   : {"issues_access_level": "disabled", "merge_requests_access_level": "disabled"}
- skip group desc.   (--no-group-description)   : False
- skip project desc. (--no-project-description) : False
🏢 Group to-be-continuous (11012625) => to-be-continuous...
Traceback (most recent call last):
  File "/usr/local/bin/gitlab-cp", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/usr/local/lib/python3.12/site-packages/gitlab_cp/sync.py", line 1096, in run
    client.sync_group(src_group, dest_parent_group)
  File "/usr/local/lib/python3.12/site-packages/gitlab_cp/sync.py", line 549, in sync_group
    dest_group = self.dest_client.groups.get(dest_group_full_path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gitlab/v4/objects/groups.py", line 321, in get
    return cast(Group, super().get(id=id, lazy=lazy, **kwargs))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gitlab/exceptions.py", line 340, in wrapped_f
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gitlab/mixins.py", line 123, in get
    server_data = self.gitlab.http_get(path, **kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gitlab/client.py", line 827, in http_get
    result = self.http_request(
             ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gitlab/client.py", line 787, in http_request
    raise gitlab.exceptions.GitlabAuthenticationError(
gitlab.exceptions.GitlabAuthenticationError: 401: 401 Unauthorized

Context & Configuration

The issue was reproduced using:

  • Version of the template: gitlab-sync, 8th of June 2024
  • GitLab server(s): self-managed server, 16.11.7 EE