GithubException 422 when try to update a file in the Github repository.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 1.9k
- Avg merge
- 17m
- Merged PRs (30d)
- 2
Description
Hi!, I get the follow error message when try to update a file in the repository:
github.GithubException.GithubException: 422 {"message": "Invalid request.\n\n"sha" wasn't supplied.", "documentation_url": "https://docs.github.com/rest/reference/repos#create-or-update-file-contents"}.
I attach a screenshot of the code

.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the code in the attached screenshot and the GitHub create-or-update-file-contents API documentation linked in the error. Check how the update request handles the required "sha" value, then reproduce the 422 response. Done means the file update request succeeds without the missing-sha error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100