mozilla-services / mozilla-services/updatebot

Exception: Could not decode a bugzilla response as JSON:

Open
#381 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Easy Enhancement
Dominant language
Python
Stars
9
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Sentry Issue: UPDATEBOT-DEV-19

JSONDecodeError: Expecting value: line 2 column 1 (char 1)
  File "apis/bugzilla_api.py", line 155, in findOpenBugs
    j = json.loads(r.text)
  File "__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

Exception: Could not decode a bugzilla response as JSON: 
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>502 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>

  File "automation.py", line 233, in run
    taskRunner.process_task(lib, task)
  File "/builds/worker/updatebot/tasktypes/vendoring.py", line 35, in process_task
    open_bugs = self.bugzillaProvider.find_open_bugs([j.bugzilla_id for j in all_jobs])
  File "components/logging.py", line 38, in func_wrapper
    ret = func(*args, **kwargs)
  File "components/bugzilla.py", line 247, in find_open_bugs
    return findOpenBugs(self.config['url'], filtered_ids)
  File "apis/bugzilla_api.py", line 157, in findOpenBugs
    raise Exception("Could not decode a bugzilla response as JSON: " + r.text) from e

Contributor guide

Open the contributing guide

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.

Research direction

Start in apis/bugzilla_api.py at findOpenBugs around line 155, then trace the call through components/bugzilla.py and the vendoring task in tasktypes/vendoring.py. Inspect how the HTML 502 response is handled and determine the expected behavior for a temporary non-JSON Bugzilla response; the issue is done when this failure path is handled without the reported decode exception.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.