Coveralls "Bad response: 422" upload error in CI
Coveralls accepted the connection but returned 422, meaning the request was well-formed HTTP but the coverage payload was unprocessable: a bad or missing repo token, an unknown service, or a malformed/empty report.
What this error means
The Coveralls step fails with "Bad response: 422 {\"message\":\"...\",\"error\":true}" or "Unprocessable Entity" while submitting coverage.
Error from lcovParse: 'Failed to submit coverage: Bad response: 422 {"message":
"Couldn't find a repository matching this job.","error":true}'Common causes
Missing or wrong repo token / service config
Coveralls cannot match the job to a repository without a correct COVERALLS_REPO_TOKEN (or GitHub token), so it rejects the submission with 422.
The coverage payload is empty or malformed
An empty lcov file or a report Coveralls cannot parse yields a 422 because there is no valid coverage to record.
How to fix it
Provide the correct token for the run
- Set
COVERALLS_REPO_TOKEN(or pass the GitHub token to the official action). - For Actions, use the maintained coverallsapp action which derives service identity automatically.
- Confirm the lcov file is non-empty before submitting.
- uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.infoVerify the report has content
Check the coverage file is generated and non-empty before the upload step runs.
test -s coverage/lcov.info && wc -l coverage/lcov.infoHow to prevent it
- Use the official coverallsapp/github-action so service identity is set correctly.
- Keep
COVERALLS_REPO_TOKENin secrets for non-Actions CI. - Generate a non-empty lcov report before uploading.