Skip to content

Conversation

@dhufe
Copy link

@dhufe dhufe commented Feb 11, 2026

In my case I tried to fetch issues which are assigned to my user and I used

[gitlab_instance]
service = gitlab
gitlab.only_if_assigned = USER
gitlab.owned = True
gitlab.login = USER
gitlab.token = TOKEN
gitlab.host = HOST
gitlab.import_labels_as_tags = True
gitlab.label_template = GL {{label}}
gitlab.description_template = Issue {{gitlabnumber}}: {{gitlabtitle}}

At the moment there aren't any assigned issues and the response contains an empty list. I added some code and updated the tests the for only_if_assigned behavior in GitLab service. They handle some additional edge cases for user lookup, including missing, multiple matches, and also_unassigned.

With theses changes I got no error anymore and if I created some issues in the production system, it runs just fine.

If you have any further questions, feel free to contact me.

Bests
Daniel

…e. Handle edge cases for user lookup, including missing, multiple matches, and `also_unassigned`.
@dhufe
Copy link
Author

dhufe commented Feb 11, 2026

I fogort the traceback of the error:

Traceback (most recent call last):
  File "/home/dhufe/dev/bugwarrior/.venv/lib64/python3.12/site-packages/bugwarrior/collect.py", line 45, in _aggregate_issues
    service = get_service(conf[target].service)(conf[target], conf[main_section])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dhufe/dev/bugwarrior/.venv/lib64/python3.12/site-packages/bugwarrior/services/gitlab.py", line 499, in __init__
    self.gitlab_client = GitlabClient(
                         ^^^^^^^^^^^^^
  File "/home/dhufe/dev/bugwarrior/.venv/lib64/python3.12/site-packages/bugwarrior/services/gitlab.py", line 147, in __init__
    self._fetch(f'users?username={only_if_assigned}')[-1]['id']
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
IndexError: list index out of range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant