## TL;DR

Add env: CODECOV_TOKEN - ${{ secrets.CODECOV_TOKEN }} to the upload step and remove any with: token - line. After upgrading codecov/codecov-action to v4, uploads fail (connection error/timeout) if you pass the token through the with: block.

## Steps

1. After upgrading codecov/codecov-action to v4, uploads fail (connection error/timeout) if you pass the token through the with: block. Fix: pass CODECOV_TOKEN via env instead. Add env: CODECOV_TOKEN - ${{ secrets.CODECOV_TOKEN }} to the upload step and remove any with: token - line. Passing the token via with: breaks the v4 uploader's commit creation; moving it to env fixed the upload for the reporter.

2. _Source: https://github.com/codecov/codecov-action/issues/1274 (Codecov)_

## When to use

Use this skill when you run into "v4 fails to upload: pass CODECOV_TOKEN via env, not the with block".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Sources

- https://github.com/codecov/codecov-action/issues/1274
