denoland/deno · error · TypeError
ERR_TLS_INVALID_PROTOCOL_METHOD
ERR_TLS_INVALID_PROTOCOL_METHOD
Error message
SSLv2 methods disabled
What it means
ERR_TLS_INVALID_PROTOCOL_METHOD from _tls_common: secureProtocol strings selecting SSLv2 ('SSLv2_method', 'SSLv2_client_method', 'SSLv2_server_method') are recognized but permanently disabled — SSLv2 has been insecure for decades, so requesting it always throws 'SSLv2 methods disabled' rather than attempting any negotiation.
Solutions
- Switch to secureProtocol: 'TLSv1_2_method' or, better, minVersion: 'TLSv1.2'
- Remove the option entirely to use safe modern defaults
- If a peer truly requires SSLv2, retire the peer — it cannot be supported
Example fix
// before
tls.connect({ secureProtocol: 'SSLv2_method', host }); // throws
// after
tls.connect({ minVersion: 'TLSv1.2', maxVersion: 'TLSv1.3', host }); Defensive patterns
Strategy: validation
Validate before calling
const DISABLED = [/^SSLv2_(client_|server_)?method$/, /^SSLv3_(client_|server_)?method$/];
if (DISABLED.some((r) => r.test(opts.secureProtocol ?? ''))) {
throw new Error('SSLv2/SSLv3 are disabled; use minVersion/maxVersion');
} Type guard
const isSupportedSecureProtocol = (s) => /^(SSLv23|TLSv1|TLSv1_1|TLSv1_2)_(client_|server_)?method$/.test(s);
Prevention
- Grep configs for 'SSLv' method strings during security reviews
- Use version ranges (minVersion/maxVersion), not method selectors
When it happens
Trigger: tls.connect({ secureProtocol: 'SSLv2_method' }); https.createServer({ secureProtocol: 'SSLv2_server_method' }, handler);
Common situations: Ancient config files or 2000s-era vendor sample code; interoperability tests written against obsolete peers; hardcoded method lists that were never pruned during cleanups.
Understand the failure class
- SSL/TLS and certificate errors — how TLS handshakes and certificate validation fail.
Related errors
- ERR_TLS_INVALID_PROTOCOL_VERSION
- ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED
- ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH
- ERR_INVALID_ARG_TYPE
- ERR_INVALID_ARG_TYPE
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/71bf51569a63ca8a.
Report an issue: GitHub.
Appendix: source
Thrown at ext/node/polyfills/_tls_common.ts:310
if (options.secureProtocol) {
// If secureProtocol is set, minVersion/maxVersion must not also be set.
// Node raises this conflict before validating the protocol method string.
if (options.minVersion || options.maxVersion) {
throw new ERR_TLS_PROTOCOL_VERSION_CONFLICT(
options.minVersion || options.maxVersion,
"secureProtocol",
);
}
const range = kProtocolMap[options.secureProtocol];
if (!range) {
if (
options.secureProtocol === "SSLv2_method" ||
options.secureProtocol === "SSLv2_client_method" ||
options.secureProtocol === "SSLv2_server_method"
) {
throw new ERR_TLS_INVALID_PROTOCOL_METHOD("SSLv2 methods disabled");
}
if (
options.secureProtocol === "SSLv3_method" ||
options.secureProtocol === "SSLv3_client_method" ||
options.secureProtocol === "SSLv3_server_method"
) {
throw new ERR_TLS_INVALID_PROTOCOL_METHOD("SSLv3 methods disabled");
}
throw new ERR_TLS_INVALID_PROTOCOL_METHOD(
`Unknown method: ${options.secureProtocol}`,
);
}
minVersion = range[0];
maxVersion = range[1];
} else {
if (options.minVersion) {
if (!SetPrototypeHas(kValidVersions, options.minVersion)) {View on GitHub (pinned to 9ad36f7a2c)