codecov / codecov/codecov-action

[BUG] Upload failed: {"message":"Token required because branch is protected"} is unhelpful

Open
#1,918 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.7k
Forks
260
Avg merge
1d 7h
Merged PRs (30d)
1

Description

Describe the bug
I'm trying to get tokenless to work in forks. And all I get is: https://github.com/check-spelling-sandbox/codecov-action/actions/runs/22902897563/job/66453728930#step:5:418

debug - 2026-03-10 12:40:22,886 -- Upload result --- {"result": "RequestResult(error=RequestError(code='HTTP Error 400', params={}, description='{\"message\":\"Token required because branch is protected\"}\\n'), warnings=[], status_code=400, text='{\"message\":\"Token required because branch is protected\"}\\n')"}
error - 2026-03-10 12:40:22,886 -- Upload failed: {"message":"Token required because branch is protected"}

To Reproduce
Steps to reproduce the behavior:

  1. Make some small changes to the codecov action to try to get tokenless to behave: https://github.com/check-spelling-sandbox/codecov-action/commit/7eaa93276766b8789b834df71e1ca5cb9ad9f9f1
  2. https://github.com/check-spelling-sandbox/codecov-action/actions/runs/22902897563/job/66453728930#step:5:418

Expected behavior
Either:

  • A clear and concise error explaining what it's talking about. I promise that I did not set up a codecov account and mark the use-tokenless-for-fork branch as protected
  • It should work (which is to say, someone explains what additional changes I need to do to make this actually work at which time we can fix the branch and make a PR to this repository to fix the use case)

Regression
No

Screenshots

Image Image Image

Product Area
reporting

Versions

Commit and CI link
https://github.com/check-spelling-sandbox/codecov-action/commit/7eaa93276766b8789b834df71e1ca5cb9ad9f9f1
https://github.com/check-spelling-sandbox/codecov-action/actions/runs/22902897563/job/66453728930

Additional context

There are probably a dozen bugs about tokenless and forks. Periodically I come and complain that it's a mess.

I'm currently here because dragonflyoss uses codecov and forks of their repository trigger codecov uploads which fail which results in every workflow failing: https://github.com/check-spelling-sandbox/nydus/actions/workflows/smoke.yml -- some of these fail exclusively because of codecov, and some would also fail because of some change I made. But because they always fail because of codecov, I can't easily see when I broke something. This defeats the point of having a smoketest or ci.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure using the referenced codecov-action commit and GitHub Actions job, then inspect the uploader path that reports the HTTP 400 response. Compare tokenless uploads from forks with protected-branch behavior. Done means either tokenless fork uploads work or the action reports a clear, actionable explanation of the required configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, python
Domain
ci-cd, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.