github3.exceptions.UnprocessableEntity: 422 Validation Failed
bboe opened this issue · comments
Traceback (most recent call last):
File "/home/bboe/.venv/farcy/bin/farcy", line 11, in <module>
sys.exit(main())
File "/home/bboe/.venv/farcy/local/lib/python2.7/site-packages/farcy/__init__.py", line 388, in main
Farcy(config).run()
File "/home/bboe/.venv/farcy/local/lib/python2.7/site-packages/farcy/__init__.py", line 370, in run
getattr(self, event.type)(event)
File "/home/bboe/.venv/farcy/local/lib/python2.7/site-packages/farcy/__init__.py", line 349, in PullRequestEvent
self.handle_pr(pr)
File "/home/bboe/.venv/farcy/local/lib/python2.7/site-packages/farcy/__init__.py", line 316, in handle_pr
pfile, pr, sha, handle_data) or exception
File "/home/bboe/.venv/farcy/local/lib/python2.7/site-packages/farcy/__init__.py", line 210, in _handle_pr_file
(pr.create_review_comment(msg, sha, pfile.filename, line)
File "/home/bboe/.venv/farcy/local/lib/python2.7/site-packages/github3/decorators.py", line 33, in auth_wrapper
return func(self, *args, **kwargs)
File "/home/bboe/.venv/farcy/local/lib/python2.7/site-packages/github3/pulls.py", line 226, in create_review_comment
json = self._json(self._post(url, data=data), 201)
File "/home/bboe/.venv/farcy/local/lib/python2.7/site-packages/github3/models.py", line 157, in _json
if self._boolean(response, status_code, 404) and response.content:
File "/home/bboe/.venv/farcy/local/lib/python2.7/site-packages/github3/models.py", line 178, in _boolean
raise exceptions.error_for(response)
github3.exceptions.UnprocessableEntity: 422 Validation Failed
This issue one happened again. Should try to fix soon.
Looks like maybe the data aren't correct in such cases:
I have the same issue is there some workaround?
@LuxoftAKutsan the solution will likely involve catching the exception and retrying whatever occurred. It's possible there is some useful information provided along with the exception. A solution won't take long to come up with, however, it's a matter of having time to do it. Stay tuned, or feel free to take a stab at it.
I noticed, that this exception raises only after second authentication with the same params.
So no I made some ugly workaround:
note = "SDLMetricsCollector_hash" + randomword(10)
note_url = "https://github.com/LuxoftAKutsan/SDLMetricsCollector"
scopes = ['user', 'repo']
auth = github3.authorize(user, password, scopes, note, note_url)
I add random charters in note on the second auth.
{'code': 422,
'errors': [{u'code': u'invalid',
u'field': u'path',
u'resource': u'PullRequestReviewComment'}],
'msg': u'Validation Failed',
'response': <Response [422]>}
It looks like the line that the error is on may not map to a commentable line.