500 error while creating a new commit

Using the REST API to create an empty commit

curl --location --request POST 'https://api.github.com/repos/{owner}/{repo}/git/commits' \
--header 'accept: application/vnd.github.switcheroo-preview+json' \
--header 'Authorization: Bearer <redacted>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "message": "empty commit",
    "tree": "4b825dc642cb6eb9a060e54bf8d69288fbee4904"

throws a 500 error on some repos but works on some. I’ve tried with accept: application/vnd.github.v3+json which also results in same error. There is response body - just 500 Internal Server Error

Not sure if it matters but all these repos are clones of a template repo. The template repo itself fails and 2 of its clones fail. Only one of them succeeds.

Does anyone have any ideas what could be causing this?