KeyError: 'bug_count' in `__get_bugs_by_search()`

Open
#240 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
backend, data

Research direction

Start in libmozdata/bugzilla.py at __get_bugs_by_search(), where the traceback shows the response is read at line 610. Inspect the response produced by the search before accessing bug_count; done means this path no longer raises KeyError when that field is absent.

Written by the indexing model from the issue text.

Description

bug
2023-07-27 19:42:17,365 - ERROR - Rule prod_comp_changed_with_priority
Traceback (most recent call last):
  File "/home/rm_bot/bugbot/bugbot/bzcleaner.py", line 844, in run
    self.send_email(date=date)
  File "/home/rm_bot/bugbot/bugbot/bzcleaner.py", line 763, in send_email
    data = self.get_email_data(date)
  File "/home/rm_bot/bugbot/bugbot/bzcleaner.py", line 681, in get_email_data
    bugs = self.get_bugs(date=date)
  File "/home/rm_bot/bugbot/bugbot/rules/prod_comp_changed_with_priority.py", line 104, in get_bugs
    bugs = super(ProdCompChangedWithPriority, self).get_bugs(
  File "/home/rm_bot/bugbot/bugbot/bzcleaner.py", line 456, in get_bugs
    ).get_data().wait()
  File "/home/rm_bot/bugbot/venv/lib/python3.10/site-packages/libmozdata/bugzilla.py", line 171, in get_data
    self.__get_bugs_for_history_comment()
  File "/home/rm_bot/bugbot/venv/lib/python3.10/site-packages/libmozdata/bugzilla.py", line 545, in __get_bugs_for_history_comment
    self.__get_bugs_by_search()
  File "/home/rm_bot/bugbot/venv/lib/python3.10/site-packages/libmozdata/bugzilla.py", line 610, in __get_bugs_by_search
    count = r.json()["bug_count"]
KeyError: 'bug_count'
2023-07-27 19:42:19,037 - ERROR - Rule regression_but_type_enhancement_task
Traceback (most recent call last):
  File "/home/rm_bot/bugbot/bugbot/bzcleaner.py", line 844, in run
    self.send_email(date=date)
  File "/home/rm_bot/bugbot/bugbot/bzcleaner.py", line 763, in send_email
    data = self.get_email_data(date)
  File "/home/rm_bot/bugbot/bugbot/bzcleaner.py", line 681, in get_email_data
    bugs = self.get_bugs(date=date)
  File "/home/rm_bot/bugbot/bugbot/bzcleaner.py", line 456, in get_bugs
    ).get_data().wait()
  File "/home/rm_bot/bugbot/venv/lib/python3.10/site-packages/libmozdata/bugzilla.py", line 171, in get_data
    self.__get_bugs_for_history_comment()
  File "/home/rm_bot/bugbot/venv/lib/python3.10/site-packages/libmozdata/bugzilla.py", line 545, in __get_bugs_for_history_comment
    self.__get_bugs_by_search()
  File "/home/rm_bot/bugbot/venv/lib/python3.10/site-packages/libmozdata/bugzilla.py", line 610, in __get_bugs_by_search
    count = r.json()["bug_count"]
KeyError: 'bug_count'
Dominant language
Python
Stars
12
Forks
19
Avg merge
1d 17h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/libmozdata

All issues in mozilla/libmozdata

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.