Cypress "Record Key is not valid" - cypress run --record Fails in CI
Recording a run to Cypress Cloud needs a valid Record Key tied to the project. The run fails when --record is passed without a key, the key is wrong/rotated, or the projectId does not match the key’s project.
What this error means
cypress run --record aborts with "Your Record Key ... is not valid with this projectId" or "You passed the --record flag but did not provide a Record Key." Non-recording runs work; only the Cloud-recording path fails.
You passed the --record flag but did not provide a Record Key.
# or
Your Record Key <...> is not valid with this projectId: abc123
Please log into the Dashboard to verify.Common causes
Record Key missing from the CI environment
The CYPRESS_RECORD_KEY secret is not set in the job (or not exposed to forks), so --record has no key to authenticate with.
Key/projectId mismatch or rotated key
The key belongs to a different project than the configured projectId, or it was rotated in the Cloud dashboard and the CI secret still holds the old value.
How to fix it
Provide the key via a CI secret
Set the record key as an environment secret and reference it - do not hard-code it.
# .github/workflows/ci.yml
- run: npx cypress run --record
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}Align the key, projectId, and rotation
- Confirm
projectIdincypress.configmatches the project the key belongs to. - Re-copy the key from the Cloud dashboard if it was rotated, and update the CI secret.
- Remember forked-PR builds do not get secrets - skip recording or use a dedicated flow there.
How to prevent it
- Store the record key only as a CI secret.
- Keep
projectIdand the key’s project in sync. - Rotate the CI secret whenever the Cloud key is rotated.