{"record":{"id":"74231c410057d497","repo":"denoland/deno","slug":"err-incompatible-option-pair-74231c","errorCode":"ERR_INCOMPATIBLE_OPTION_PAIR","errorMessage":"Option \"dereference\" cannot be used in combination with option \"verbatimSymlinks\"","messagePattern":"Option \"dereference\" cannot be used in combination with option \"verbatimSymlinks\"","errorType":"validation","errorClass":"ERR_INCOMPATIBLE_OPTION_PAIR","httpStatus":null,"severity":"error","filePath":"ext/node/polyfills/internal/fs/utils.mjs","lineNumber":1008,"sourceCode":"  recursive: false,\n};\n\n/** @type {(options: CopyOptionsBase | undefined) => CopyOptionsBase} */\nexport const validateCpOptions = hideStackFrames((options) => {\n  if (options === undefined) {\n    return { ...defaultCpOptions };\n  }\n  validateObject(options, \"options\");\n  options = { ...defaultCpOptions, ...options };\n  validateBoolean(options.dereference, \"options.dereference\");\n  validateBoolean(options.errorOnExist, \"options.errorOnExist\");\n  validateBoolean(options.force, \"options.force\");\n  validateBoolean(options.preserveTimestamps, \"options.preserveTimestamps\");\n  validateBoolean(options.recursive, \"options.recursive\");\n  validateBoolean(options.verbatimSymlinks, \"options.verbatimSymlinks\");\n  options.mode = getValidMode(options.mode, \"copyFile\");\n  if (options.dereference === true && options.verbatimSymlinks === true) {\n    throw new ERR_INCOMPATIBLE_OPTION_PAIR(\"dereference\", \"verbatimSymlinks\");\n  }\n  if (options.filter !== undefined) {\n    validateFunction(options.filter, \"options.filter\");\n  }\n  return options;\n});\n\n/**\n * @typedef {{\n *   force: boolean;\n *   recursive?: boolean;\n *   retryDelay?: number;\n *   maxRetries?: number;\n * }} RmOptions\n */\n\n/**\n * @typedef {(err: Error | false | null, options?: RmOptions) => void} RmOptionsCallback","sourceCodeStart":990,"sourceCodeEnd":1026,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/node/polyfills/internal/fs/utils.mjs#L990-L1026","documentation":"The option normalizer for fs.cp validates each boolean flag and then rejects the combination dereference: true with verbatimSymlinks: true using ERR_INCOMPATIBLE_OPTION_PAIR. The flags give opposite instructions — dereference copies the targets' contents, verbatimSymlinks recreates the links as-is without resolving them — so no single copy can satisfy both.","triggerScenarios":"fs.cp(src, dest, { recursive: true, dereference: true, verbatimSymlinks: true }); merging two presets that each enable one flag; layered config (defaults plus user overrides) where both end up true.","commonSituations":"Deploy/copy scripts accumulating options from CLI flags, config files and presets; combining a 'follow links' preset with a 'preserve links' preset; copying node_modules or build trees where either strategy is wanted but never both.","solutions":["Pick one strategy: dereference to copy contents, verbatimSymlinks to recreate links verbatim — enable exactly one.","Delete the other key when merging presets instead of leaving stale values.","Validate the merged options object with a two-line check before calling fs.cp."],"exampleFix":"// before\nawait fs.promises.cp(src, dest, { recursive: true, dereference: true, verbatimSymlinks: true }); // throws\n\n// after — copy link targets' contents\nawait fs.promises.cp(src, dest, { recursive: true, dereference: true });\n// or — recreate symlinks verbatim\nawait fs.promises.cp(src, dest, { recursive: true, verbatimSymlinks: true });","handlingStrategy":"validation","validationCode":"if (opts?.dereference === true && opts?.verbatimSymlinks === true) {\n  throw new Error('cp options are contradictory: dereference copies targets, verbatimSymlinks preserves links — pick one');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide symlink strategy per copy job and set exactly one flag.","When merging option presets, delete the losing key instead of leaving it true.","Document the chosen strategy next to the copy call for the next maintainer."],"tags":["filesystem","cp","copy","symlink","options"],"backgroundTag":"incompatible-option-combination","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}