sir-lancebot icon indicating copy to clipboard operation
sir-lancebot copied to clipboard

KeyError: 'draft'

Open sentry[bot] opened this issue 4 years ago • 9 comments
trafficstars

Sentry Issue: SIR-LANCEBOT-6X

KeyError: 'draft'
  File "discord/ext/commands/core.py", line 167, in wrapped
    ret = await coro(*args, **kwargs)
  File "bot/exts/utilities/issues.py", line 211, in issue
    results = [await self.fetch_issues(number, repository, user) for number in numbers]
  File "bot/exts/utilities/issues.py", line 211, in <listcomp>
    results = [await self.fetch_issues(number, repository, user) for number in numbers]
  File "bot/exts/utilities/issues.py", line 142, in fetch_issues
    if pull_data["draft"]:

Unhandled command error: 'draft'

sentry[bot] avatar Oct 25 '21 13:10 sentry[bot]

Can someone supply more details about this? I don't have authorization to view the issue in Sentry. It would be helpful to have a steps-to-reproduce or something similar. Thanks!

katimoth avatar Dec 10 '21 19:12 katimoth

Can someone supply more details about this? I don't have authorization to view the issue in Sentry. It would be helpful to have a steps-to-reproduce or something similar. Thanks!

Looking at the error, it mentions File "bot/exts/utilities/issues.py", line 142, in fetch_issues.

That leads me to this line https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/utilities/issues.py#L142

So it seems pull_data here is the response from GitHub converted to a dict using .json().

Since this is a KeyError, this suggests that the response from GitHub's API doesn't always return a draft key, so we should handle that.

ChrisLovering avatar Dec 10 '21 20:12 ChrisLovering

There really isn’t much else to this. The command ran was pr 919, which does not currently produce an error. The original triggering message has been deleted, but it doesn’t add any useful context here.

I can only assume the API returned something unexpected, so let’s just add a check for that.

HassanAbouelela avatar Dec 10 '21 20:12 HassanAbouelela

@ChrisLovering Thank you! Could you assign me and @evgriff to this?

katimoth avatar Dec 10 '21 20:12 katimoth

@ChrisLovering Thank you! Could you assign me and @evgriff to this?

I've assigned you to the issue. I can't assign the other person, as I can only assign people who have commented.

ChrisLovering avatar Dec 10 '21 20:12 ChrisLovering

this would be fixed as part of #968, if not fixed as part of #778 (which is waiting on one approval)

onerandomusername avatar Dec 10 '21 20:12 onerandomusername

I believe this has been resolved with #778, closing.

HassanAbouelela avatar Mar 21 '22 06:03 HassanAbouelela

I believe this has been resolved with https://github.com/python-discord/sir-lancebot/pull/778, closing.

This was not fixed with #778. https://github.com/python-discord/sir-lancebot/blob/657aaf5f613b0bd219d67c71f7dc37ede0bb6aab/bot/exts/utilities/githubinfo.py#L129-L130

onerandomusername avatar Mar 23 '22 06:03 onerandomusername

I believe this has been resolved with #778, closing.

This was not fixed with #778.

https://github.com/python-discord/sir-lancebot/blob/657aaf5f613b0bd219d67c71f7dc37ede0bb6aab/bot/exts/utilities/githubinfo.py#L129-L130

@HassanAbouelela

onerandomusername avatar Apr 26 '22 07:04 onerandomusername