{"record":{"id":"6d5c8148c46c4518","repo":"cypress-io/cypress","slug":"spec-not-found","errorCode":"SPEC_NOT_FOUND","errorMessage":"No file exists at path ${specPath}","messagePattern":"No file exists at path (.+?)","errorType":"error_code","errorClass":"RunSpecError","httpStatus":null,"severity":"error","filePath":"packages/data-context/src/actions/ProjectActions.ts","lineNumber":549,"sourceCode":"\n      // Check to see whether input specPath matches the specPattern for one or the other testing type\n      // If it matches neither then we can't run the spec and we should error\n      if (await this.ctx.project.matchesSpecPattern(relativeSpecPath, 'e2e')) {\n        targetTestingType = 'e2e'\n      } else if (await this.ctx.project.matchesSpecPattern(relativeSpecPath, 'component')) {\n        targetTestingType = 'component'\n      } else {\n        throw new RunSpecError('NO_SPEC_PATTERN_MATCH', 'Unable to determine testing type, spec does not match any configured specPattern')\n      }\n\n      debug(`Spec %s matches '${targetTestingType}' pattern`, specPath)\n\n      debug('Attempting to launch spec %s', specPath)\n\n      // Look to see if there's actually a file at the target location\n      // This helps us avoid switching testingType *then* finding out the spec doesn't exist\n      if (!this.ctx.fs.existsSync(specPath)) {\n        throw new RunSpecError('SPEC_NOT_FOUND', `No file exists at path ${specPath}`)\n      }\n\n      // We now know what testingType we need to be in - if we're already there, great\n      // If not, verify that type is configured then switch (or throw an error if not configured)\n      if (this.ctx.coreData.currentTestingType !== targetTestingType) {\n        if (!this.ctx.lifecycleManager.isTestingTypeConfigured(targetTestingType)) {\n          throw new RunSpecError('TESTING_TYPE_NOT_CONFIGURED', `Input path matched specPattern for '${targetTestingType}' testing type, but it is not configured.`)\n        }\n\n        debug('Setting testing type to %s', targetTestingType)\n\n        const specChangeSubscription = this.ctx.emitter.subscribeTo('specsChange', { sendInitial: false })\n\n        const originalTestingType = this.ctx.coreData.currentTestingType\n\n        // Temporarily toggle testing type so the `activeBrowser` can be initialized\n        // for the targeted testing type. Browser has to be initialized prior to our \"relaunch\"\n        // call below - this can be an issue when Cypress is still on the launchpad and no","sourceCodeStart":531,"sourceCodeEnd":567,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/packages/data-context/src/actions/ProjectActions.ts#L531-L567","documentation":"Thrown by ProjectActions.runSpec (ProjectActions.ts:548-550) with code SPEC_NOT_FOUND when this.ctx.fs.existsSync(specPath) returns false. It is checked AFTER the testing type is resolved from specPattern but BEFORE any testing-type switch, intentionally so Cypress fails fast instead of switching testing types only to discover the file is missing. distinct from error 67, which checks the loaded-spec list later. Returned as { code: 'SPEC_NOT_FOUND', detailMessage }.","triggerScenarios":"specPath matches a specPattern (so it passes the testing-type resolution) but no file actually exists on disk at that absolute path at run time.","commonSituations":"Stale spec list in the UI pointing at a file that was deleted/moved/renamed since the list was built; case-sensitivity mismatch on Linux/macOS (MySpec.cy.ts vs myspec.cy.ts); wrong drive or absolute path on Windows; file present in a different working tree; a path with a typo or trailing whitespace.","solutions":["Verify the file exists at the exact absolute path passed (check case on case-sensitive filesystems).","Refresh the spec list in the UI so stale entries are removed before running.","Ensure specPath is an absolute, normalized path with no trailing whitespace/slash.","If the file was renamed, run the new name; if deleted, remove the dangling reference."],"exampleFix":"// before\nawait runSpec({ specPath })\n\n// after\nif (!fs.existsSync(specPath)) {\n  await ctx.actions.refreshSpecs() // or surface 'file missing' to user\n  return\n}\nawait runSpec({ specPath })","handlingStrategy":"validation","validationCode":"// Verify the file exists on disk before invoking runSpec\nimport { existsSync } from 'fs-extra'\n\nif (!existsSync(specPath)) {\n  // refresh the spec list or prompt the user; do not call runSpec\n  return\n}\nawait ctx.actions.runSpec({ specPath })","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass absolute, normalized paths to runSpec.","On case-sensitive filesystems (Linux), match the exact filename casing shown by the OS.","Refresh the UI spec list after delete/rename operations so stale paths are never run."],"tags":["runspec","filesystem","spec-not-found","case-sensitivity","stale-state"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}