cypress-io/cypress · error · Error
Could not find spec for id ${ curr.specId}
Error message
Could not find spec for id ${ curr.specId} What it means
Thrown inside DebugMapping.ts while mapping Cloud debug test results to local specs. For each test, Cypress looks up its specId in the locally-fetched specs array; if no spec matches, it throws because the cloud result references a spec that no longer exists locally. The inline TODO (cypress-io/cypress#25639) acknowledges this should be a UI error state, not a thrown exception.
Source
Thrown at packages/app/src/debug/utils/DebugMapping.ts:34
testingType: TestingTypeEnum
matchesCurrentTestingType: boolean
foundLocally: boolean
}
export const specsList = ({ specs, tests, localSpecs, currentTestingType, groups }: DebugSpecsArgs): CloudDebugSpec[] => {
const localSpecsSet = new Set(localSpecs.map(((spec) => posixify(spec.relative))))
const groupsMap = groups.reduce<{[id: string]: DebugSpecListGroupsFragment}>((acc, group) => ({ ...acc, [group.id]: group }), {})
const mappedTests = tests.reduce<{[id: string]: CloudDebugSpec}>((acc, curr) => {
let debugResult = acc[curr.specId]
if (!debugResult) {
const foundSpec = specs.find((spec) => spec.id === curr.specId)
if (!foundSpec) {
// TODO better handle error case by showing an error message rather than just throwing
// an error. Will be addressed in https://github.com/cypress-io/cypress/issues/25639
throw new Error(`Could not find spec for id ${ curr.specId}`)
}
const groupsMapping = (foundSpec.groupIds || []).reduce<{[grpId: string]: DebugSpecListGroupsFragment}>((acc, id) => {
if (id) {
acc[id] = groupsMap[id]
}
return acc
}, {})
// The testingType will not differ between groups
const testingType = Object.values(groupsMapping)[0].testingType as TestingTypeEnum
debugResult = {
spec: foundSpec,
tests: { [curr.thumbprint]: [curr] },
groups: groupsMapping,
testingType,
matchesCurrentTestingType: testingType === currentTestingType,View on GitHub (pinned to 0d85fdc912)
Solutions
- Refresh the Debug view / re-fetch the spec list to rule out a stale local query.
- Ensure the spec referenced by the cloud run still exists at the same path locally; restore or rename it back if not.
- Check that your specPattern in cypress.config.ts matches what was used when the run was created.
- If the run is genuinely from a different branch, switch to that branch before opening Debug.
- Track cypress-io/cypress#25639 for the future UI-error improvement.
Defensive patterns
Strategy: try-catch
Validate before calling
function allCloudSpecsExistLocally (cloudTests, localSpecs) {
const ids = new Set(localSpecs.map((s) => s.id))
const missing = cloudTests.filter((t) => !ids.has(t.specId))
return { ok: missing.length === 0, missing }
} Type guard
function specListMatchesCloud (cloudTests: { specId: string }[], localSpecs: { id: string }[]): boolean {
const ids = new Set(localSpecs.map((s) => s.id))
return cloudTests.every((t) => ids.has(t.specId))
} Try / catch
try {
buildDebugMapping(cloudTests, localSpecs)
} catch (e) {
if (/Could not find spec for id/.test(e.message)) {
// Show a UI message instead of crashing; spec was deleted/renamed since the run.
showStaleRunWarning()
return
}
throw e
} Prevention
- Do not rename or delete specs between cloud runs and Debug viewing.
- Keep specPattern stable across branches that share cloud runs.
- Track cypress-io/cypress#25639 for the upcoming UI-error improvement.
When it happens
Trigger: Opening the Debug view (Test Replay / cloud debug) for a run whose spec list changed since the run was recorded — e.g. a spec was deleted, renamed, or excluded from the specPattern between when the run was uploaded and when the local Debug view is opened. Also seen when the local query for specs returns a stale or filtered set.
Common situations: Spec renamed/moved after a cloud run, branches with different spec sets, gated specs filtered by @cypress/grep producing different local vs cloud lists, or partial network responses from the Cloud API.
AI-assisted analysis of cypress-io/cypress@0d85fdc912 (2026-08-12).
Data as JSON: /api/errors/43a34f7aa1086203.
Report an issue: GitHub.