{"record":{"id":"fbac703645a6fba2","repo":"denoland/deno","slug":"err-incompatible-option-pair-fbac70","errorCode":"ERR_INCOMPATIBLE_OPTION_PAIR","errorMessage":"Option \"options.inspectOptions.color\" cannot be used in combination with option \"colorMode\"","messagePattern":"Option \"options\\.inspectOptions\\.color\" cannot be used in combination with option \"colorMode\"","errorType":"error_code","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ext/node/polyfills/internal/console/constructor.mjs","lineNumber":188,"sourceCode":"  }\n\n  if (groupIndentation !== undefined) {\n    validateInteger(\n      groupIndentation,\n      \"groupIndentation\",\n      0,\n      kMaxGroupIndentation,\n    );\n  }\n\n  if (inspectOptions !== undefined) {\n    validateObject(inspectOptions, \"options.inspectOptions\");\n\n    if (\n      inspectOptions.colors !== undefined &&\n      options.colorMode !== undefined\n    ) {\n      throw new ERR_INCOMPATIBLE_OPTION_PAIR(\n        \"options.inspectOptions.color\",\n        \"colorMode\",\n      );\n    }\n    WeakMapPrototypeSet(optionsMap, this, inspectOptions);\n  }\n\n  // Bind the prototype functions to this Console instance\n  ArrayPrototypeForEach(ObjectKeys(Console.prototype), (key) => {\n    // We have to bind the methods grabbed from the instance instead of from\n    // the prototype so that users extending the Console can override them\n    // from the prototype chain of the subclass.\n    this[key] = FunctionPrototypeBind(this[key], this);\n    ObjectDefineProperty(this[key], \"name\", {\n      __proto__: null,\n      value: key,\n    });\n  });","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/node/polyfills/internal/console/constructor.mjs#L170-L206","documentation":"Console rejects constructing with both colorMode and inspectOptions.colors set - they control the same color setting, so ERR_INCOMPATIBLE_OPTION_PAIR is thrown. The check fires whenever colorMode is present (even 'auto') together with inspectOptions.colors !== undefined. Note a grepping gotcha: the code checks the property 'colors' but the message says 'options.inspectOptions.color' (singular), matching Node's message verbatim.","triggerScenarios":"new Console({ stdout, colorMode: 'auto', inspectOptions: { colors: true } }); merging a preset that sets inspectOptions.colors with user config that sets colorMode; porting code that used util.inspect colors and later added colorMode.","commonSituations":"Deep-merging default options with user options where each side sets a different knob; copy-pasted logger presets; incremental refactors that added colorMode without removing colors from inspectOptions.","solutions":["Pick one knob: drop colorMode and keep inspectOptions.colors (or vice versa)","Strip one side when merging configs: if (merged.inspectOptions?.colors !== undefined) delete merged.colorMode","Build options conditionally: only set colorMode when inspectOptions is absent","Document the chosen knob in your logging config schema so both never appear"],"exampleFix":"// before\nnew Console({ stdout, colorMode: 'auto', inspectOptions: { colors: true } }); // ERR_INCOMPATIBLE_OPTION_PAIR\n\n// after\nnew Console({ stdout, colorMode: 'auto' });\n// or equivalently:\nnew Console({ stdout, inspectOptions: { colors: true } });","handlingStrategy":"validation","validationCode":"function buildConsoleOptions(cfg) {\n  if (cfg.inspectOptions?.colors !== undefined) {\n    const { colorMode: _drop, ...rest } = cfg;\n    return rest; // colors win, colorMode removed\n  }\n  return cfg;\n}\nconst logger = new Console(buildConsoleOptions(cfg));","typeGuard":null,"tryCatchPattern":"try {\n  logger = new Console(cfg);\n} catch (e) {\n  if (e?.code === 'ERR_INCOMPATIBLE_OPTION_PAIR') { delete cfg.colorMode; logger = new Console(cfg); }\n  else throw e;\n}","preventionTips":["Choose one color knob for the whole codebase and document it","After deep-merging option presets, strip known-conflicting pairs before construction","Note the error text says 'inspectOptions.color' while the property is 'colors' - search for both when grepping logs"],"tags":["console","options","colors","configuration"],"backgroundTag":"incompatible-option-pair","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}