{"id":"92a030744fd5adc3","repo":"jestjs/jest","slug":"jest-haste-map-enablesymlinks-config-option-was-s","errorCode":null,"errorMessage":"jest-haste-map: enableSymlinks config option was set, but is incompatible with watchman.\nSet either `enableSymlinks` to false or `useWatchman` to false.","messagePattern":"jest-haste-map: enableSymlinks config option was set, but is incompatible with watchman\\.\nSet either `enableSymlinks` to false or `useWatchman` to false\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/jest-haste-map/src/index.ts","lineNumber":263,"sourceCode":"    this._console = options.console || globalThis.console;\n\n    if (options.ignorePattern) {\n      if (options.ignorePattern instanceof RegExp) {\n        this._options.ignorePattern = new RegExp(\n          `${options.ignorePattern.source}|${VCS_DIRECTORIES}`,\n          options.ignorePattern.flags,\n        );\n      } else {\n        throw new TypeError(\n          'jest-haste-map: the `ignorePattern` option must be a RegExp',\n        );\n      }\n    } else {\n      this._options.ignorePattern = new RegExp(VCS_DIRECTORIES);\n    }\n\n    if (this._options.enableSymlinks && this._options.useWatchman) {\n      throw new Error(\n        'jest-haste-map: enableSymlinks config option was set, but ' +\n          'is incompatible with watchman.\\n' +\n          'Set either `enableSymlinks` to false or `useWatchman` to false.',\n      );\n    }\n\n    this._ignoreFn = buildIgnoreMatcher(\n      this._options.ignorePattern,\n      this._options.retainAllFiles,\n    );\n    this._workerPool = new WorkerPool({\n      maxWorkers: this._options.maxWorkers,\n      workerPath: require.resolve('./worker'),\n      workerThreads: this._options.workerThreads,\n    });\n    this._fileProcessor = new FileProcessor(\n      {\n        computeDependencies: this._options.computeDependencies,","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/jestjs/jest/blob/f49721c78e195558b40913977c9230f5b7f559d8/packages/jest-haste-map/src/index.ts#L245-L281","documentation":"Symlink support (enableSymlinks) and watchman-backed crawling/watching (useWatchman) are mutually exclusive in jest-haste-map, because watchman's symlink semantics conflict with the resolveSymlinks:false mode the library requires. The constructor hard-fails at index.ts:262 if both are true so that haste-map never silently tracks files under the wrong path.","triggerScenarios":"Constructing HasteMap with both `enableSymlinks: true` and `useWatchman: true` (default). In Jest config this comes from `haste.enableSymlinks: true` combined with a caller (jest-core/jest-runtime) that passes `watchman: true`. The guard at index.ts:262 throws immediately during construction.","commonSituations":"Enabling symlinks to support pnpm/npm-linked workspaces or a monorepo with symlinked node_modules, while leaving watchman enabled (the default). Also seen after upgrading Jest where enableSymlinks became a supported haste key.","solutions":["If you need symlink support, disable watchman: set Jest config `watchman: false` (and/or pass useWatchman:false to HasteMap).","If you need watchman, disable symlinks: remove `haste.enableSymlinks` or set it to false.","Prefer disabling watchman (option 1) when your repo relies on symlinked node_modules (pnpm/yarn workspaces), because enableSymlinks is required for correct module resolution there."],"exampleFix":"// before — conflicting options\nmodule.exports = {\n  watchman: true,\n  haste: { enableSymlinks: true },\n};\n\n// after — keep symlinks, drop watchman\nmodule.exports = {\n  watchman: false,\n  haste: { enableSymlinks: true },\n};","handlingStrategy":"validation","validationCode":"if (options.enableSymlinks && options.useWatchman) {\n  // hard-incompatible per jest-haste-map index.ts:262\n  throw new Error('enableSymlinks and useWatchman are mutually exclusive; pick one.');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat enableSymlinks + useWatchman as mutually exclusive in your config layer.","For pnpm/yarn-workspace repos that need symlinked node_modules, default watchman to false.","Add a CI check that fails when both haste.enableSymlinks and watchman are set."],"tags":["haste-map","config","symlinks","watchman","validation"],"analyzedSha":"f49721c78e195558b40913977c9230f5b7f559d8","analyzedAt":"2026-08-03T20:16:28.571Z","schemaVersion":2}