{"record":{"id":"0dd96aea98d01fbc","repo":"denoland/deno","slug":"err-tls-protocol-version-conflict","errorCode":"ERR_TLS_PROTOCOL_VERSION_CONFLICT","errorMessage":"TLS protocol version ${minVersion || maxVersion} conflicts with secureProtocol secureProtocol","messagePattern":"TLS protocol version (.+?) conflicts with secureProtocol secureProtocol","errorType":"error_code","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ext/node/polyfills/_tls_common.ts","lineNumber":297,"sourceCode":"    return ArrayPrototypeFilter(\n      ArrayPrototypeMap(val, (v: any) => toStringOrUndefined(v)!),\n      Boolean,\n    );\n  }\n  return toStringOrUndefined(val);\n}\n\nfunction getProtocolRange(\n  options: any,\n): { minVersion: string; maxVersion: string } {\n  let minVersion = getDefaultMinVersion();\n  let maxVersion = getDefaultMaxVersion();\n\n  if (options.secureProtocol) {\n    // If secureProtocol is set, minVersion/maxVersion must not also be set.\n    // Node raises this conflict before validating the protocol method string.\n    if (options.minVersion || options.maxVersion) {\n      throw new ERR_TLS_PROTOCOL_VERSION_CONFLICT(\n        options.minVersion || options.maxVersion,\n        \"secureProtocol\",\n      );\n    }\n\n    const range = kProtocolMap[options.secureProtocol];\n    if (!range) {\n      if (\n        options.secureProtocol === \"SSLv2_method\" ||\n        options.secureProtocol === \"SSLv2_client_method\" ||\n        options.secureProtocol === \"SSLv2_server_method\"\n      ) {\n        throw new ERR_TLS_INVALID_PROTOCOL_METHOD(\"SSLv2 methods disabled\");\n      }\n      if (\n        options.secureProtocol === \"SSLv3_method\" ||\n        options.secureProtocol === \"SSLv3_client_method\" ||\n        options.secureProtocol === \"SSLv3_server_method\"","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/node/polyfills/_tls_common.ts#L279-L315","documentation":"ERR_TLS_PROTOCOL_VERSION_CONFLICT from _tls_common's getProtocolRange(): TLS socket options accept either the legacy secureProtocol method selector (e.g. 'TLSv1_2_method') or the modern minVersion/maxVersion range — never both. If secureProtocol is set and minVersion or maxVersion is also truthy, the conflict is thrown before any other validation, echoing the offending version string.","triggerScenarios":"tls.connect({ secureProtocol: 'TLSv1_2_method', minVersion: 'TLSv1.2' }); https.createServer({ secureProtocol: 'SSLv23_method', maxVersion: 'TLSv1.3' }, handler);","commonSituations":"Legacy codebases carrying secureProtocol that receive a TLS-hardening patch adding minVersion; merged configs combining old and new styles; guidance copied from docs of different eras.","solutions":["Delete secureProtocol and keep minVersion/maxVersion (the modern style)","Or keep secureProtocol and remove minVersion/maxVersion entirely","Best modern default: minVersion: 'TLSv1.2', maxVersion: 'TLSv1.3'"],"exampleFix":"// before\ntls.connect({ secureProtocol: 'TLSv1_2_method', minVersion: 'TLSv1.2', host }); // throws\n\n// after\ntls.connect({ minVersion: 'TLSv1.2', maxVersion: 'TLSv1.3', host });","handlingStrategy":"validation","validationCode":"if (opts.secureProtocol && (opts.minVersion || opts.maxVersion)) {\n  throw new Error('secureProtocol cannot be combined with minVersion/maxVersion');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on minVersion/maxVersion in a shared TLS config helper","Lint against new uses of secureProtocol in code review"],"tags":["tls","https","configuration","node-compat"],"backgroundTag":"tls-version-conflict","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}