{"record":{"id":"43a34f7aa1086203","repo":"cypress-io/cypress","slug":"could-not-find-spec-for-id-curr-specid","errorCode":null,"errorMessage":"Could not find spec for id ${ curr.specId}","messagePattern":"Could not find spec for id (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app/src/debug/utils/DebugMapping.ts","lineNumber":34,"sourceCode":"  testingType: TestingTypeEnum\n  matchesCurrentTestingType: boolean\n  foundLocally: boolean\n}\n\nexport const specsList = ({ specs, tests, localSpecs, currentTestingType, groups }: DebugSpecsArgs): CloudDebugSpec[] => {\n  const localSpecsSet = new Set(localSpecs.map(((spec) => posixify(spec.relative))))\n  const groupsMap = groups.reduce<{[id: string]: DebugSpecListGroupsFragment}>((acc, group) => ({ ...acc, [group.id]: group }), {})\n\n  const mappedTests = tests.reduce<{[id: string]: CloudDebugSpec}>((acc, curr) => {\n    let debugResult = acc[curr.specId]\n\n    if (!debugResult) {\n      const foundSpec = specs.find((spec) => spec.id === curr.specId)\n\n      if (!foundSpec) {\n        // TODO better handle error case by showing an error message rather than just throwing\n        // an error. Will be addressed in https://github.com/cypress-io/cypress/issues/25639\n        throw new Error(`Could not find spec for id ${ curr.specId}`)\n      }\n\n      const groupsMapping = (foundSpec.groupIds || []).reduce<{[grpId: string]: DebugSpecListGroupsFragment}>((acc, id) => {\n        if (id) {\n          acc[id] = groupsMap[id]\n        }\n\n        return acc\n      }, {})\n      // The testingType will not differ between groups\n      const testingType = Object.values(groupsMapping)[0].testingType as TestingTypeEnum\n\n      debugResult = {\n        spec: foundSpec,\n        tests: { [curr.thumbprint]: [curr] },\n        groups: groupsMapping,\n        testingType,\n        matchesCurrentTestingType: testingType === currentTestingType,","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/packages/app/src/debug/utils/DebugMapping.ts#L16-L52","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function allCloudSpecsExistLocally (cloudTests, localSpecs) {\n  const ids = new Set(localSpecs.map((s) => s.id))\n  const missing = cloudTests.filter((t) => !ids.has(t.specId))\n  return { ok: missing.length === 0, missing }\n}","typeGuard":"function specListMatchesCloud (cloudTests: { specId: string }[], localSpecs: { id: string }[]): boolean {\n  const ids = new Set(localSpecs.map((s) => s.id))\n  return cloudTests.every((t) => ids.has(t.specId))\n}","tryCatchPattern":"try {\n  buildDebugMapping(cloudTests, localSpecs)\n} catch (e) {\n  if (/Could not find spec for id/.test(e.message)) {\n    // Show a UI message instead of crashing; spec was deleted/renamed since the run.\n    showStaleRunWarning()\n    return\n  }\n  throw e\n}","preventionTips":["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."],"tags":["debug","cloud","spec-resolution","ui","test-replay"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}