Skip to content

Deleting a label fails with 404 #1867

@just-doit

Description

@just-doit

Description of the problem, including code/CLI snippet

I'm trying to delete all labels from a given project using this code:

# connect to Gitlab
gl = gitlab.Gitlab(GITLAB_URL, private_token=GITLAB_TOKEN)
gl.auth()

# Get GitLab project
gl_project = gl.projects.get(GITLAB_PROJECT_ID)

# delete ALL labels
for gl_label in gl_project.labels.list(all=True):
    gl_label.delete()

The token works since I've used it successfully to do some other API calls before. The same user is able to delete labels manually via Web-UI.

Expected Behavior

I would expect the code not to throw a `gitlab.exceptions.GitlabDeleteError: 404: 404 Label Not Found'

Actual Behavior

The delete call fails with a gitlab.exceptions.GitlabDeleteError: 404: 404 Label Not Found.

Specifications

  • python-gitlab version: 3.1.1
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): GitLab Enterprise Edition 14.5.0-ee

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions