{"id":"0ea3867114baa279","repo":"sindresorhus/got","slug":"https-option-key-does-not-exist","errorCode":null,"errorMessage":"HTTPS option `${key}` does not exist","messagePattern":"HTTPS option `(.+?)` does not exist","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"source/core/options.ts","lineNumber":3209,"sourceCode":"\t\tassertAny('https.alpnProtocols', [is.array, is.undefined], value.alpnProtocols);\n\t\tassertAny('https.ciphers', [is.string, is.undefined], value.ciphers);\n\t\tassertAny('https.dhparam', [is.string, is.buffer, is.undefined], value.dhparam);\n\t\tassertAny('https.signatureAlgorithms', [is.string, is.undefined], value.signatureAlgorithms);\n\t\tassertAny('https.minVersion', [is.string, is.undefined], value.minVersion);\n\t\tassertAny('https.maxVersion', [is.string, is.undefined], value.maxVersion);\n\t\tassertAny('https.honorCipherOrder', [is.boolean, is.undefined], value.honorCipherOrder);\n\t\tassertAny('https.tlsSessionLifetime', [is.number, is.undefined], value.tlsSessionLifetime);\n\t\tassertAny('https.ecdhCurve', [is.string, is.undefined], value.ecdhCurve);\n\t\tassertAny('https.certificateRevocationLists', [is.string, is.buffer, is.array, is.undefined], value.certificateRevocationLists);\n\t\tassertAny('https.secureOptions', [is.number, is.undefined], value.secureOptions);\n\n\t\tfor (const key of Object.keys(value)) {\n\t\t\tif (key === '__proto__') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!(key in this.#internals.https)) {\n\t\t\t\tthrow new Error(`HTTPS option \\`${key}\\` does not exist`);\n\t\t\t}\n\t\t}\n\n\t\tif (this.#merging) {\n\t\t\tsafeObjectAssign(this.#internals.https, value);\n\t\t} else {\n\t\t\tthis.#internals.https = {...value};\n\t\t}\n\t}\n\n\t/**\n\t[Encoding](https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings) to be used on `setEncoding` of the response data.\n\n\tTo get a [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), you need to set `responseType` to `buffer` instead.\n\tDon't set this option to `null`.\n\n\t__Note__: This doesn't affect streams! Instead, you need to do `got.stream(...).setEncoding(encoding)`.\n","sourceCodeStart":3191,"sourceCodeEnd":3227,"githubUrl":"https://github.com/sindresorhus/got/blob/e3924aa1e53a6ca3eb93a43618ce532442a89b40/source/core/options.ts#L3191-L3227","documentation":"Thrown by the `https` setter when the `https` options object has a key that is not a recognized advanced HTTPS/TLS option. Valid keys include `rejectUnauthorized`, `checkServerIdentity`, `serverName`, `certificateAuthority`, `key`, `certificate`, `passphrase`, `pfx`, `alpnProtocols`, `ciphers`, `dhparam`, `signatureAlgorithms`, `minVersion`, `maxVersion`, `honorCipherOrder`, `tlsSessionLifetime`, `ecdhCurve`, `certificateRevocationLists`, `secureOptions`. Unknown keys are rejected so a typo'd TLS setting does not silently leave a connection insecure.","triggerScenarios":"Calling `got(url, {https: {rejectUnauthroized: false}})` (typo), `{https: {ca: ...}}` (use `certificateAuthority`), or any `https` key outside the documented TLS options.","commonSituations":"Using Node's `tls.connect`/axios shorthand names (`ca`, `cert`, `key` already taken but `rejectUnauthorized` misspelled); typos; security-relevant config where a silent miss is dangerous.","solutions":["Use only the documented `https.*` option names (e.g. `certificateAuthority` not `ca`).","Carefully check the `${key}` spelling in the error message.","After fixing, verify the TLS behavior actually changed (e.g. via a self-signed cert test) since these settings are security-sensitive."],"exampleFix":"// before\nawait got(url, {https: {ca: pem, rejectUnauthroized: true}});\n// after\nawait got(url, {https: {certificateAuthority: pem, rejectUnauthorized: true}});","handlingStrategy":"type-guard","validationCode":"const validHttpsKeys = new Set(['rejectUnauthorized','checkServerIdentity','serverName','certificateAuthority','key','certificate','passphrase','pfx','alpnProtocols','ciphers','dhparam','signatureAlgorithms','minVersion','maxVersion','honorCipherOrder','tlsSessionLifetime','ecdhCurve','certificateRevocationLists','secureOptions']);\nfunction validateHttps(https) {\n  for (const k of Object.keys(https ?? {})) {\n    if (!validHttpsKeys.has(k)) throw new Error(`Unknown https option: ${k}`);\n  }\n}","typeGuard":"import type {HttpsOptions} from 'got';\nfunction isHttpsOptions(v: unknown): v is HttpsOptions {\n  if (typeof v !== 'object' || v === null) return false;\n  // Trust the shipped type; this guard primarily rules out non-objects.\n  return true;\n}","tryCatchPattern":null,"preventionTips":["Use the `HttpsOptions` type so typos in TLS settings are compile errors (these are security-critical).","Do not alias `ca`/`cert` from other libs; use the full Got names.","After changing TLS config, verify behavior with a deliberate failure (e.g. expired cert) to confirm it took effect."],"tags":["options","https","tls","validation","security","config"],"analyzedSha":"e3924aa1e53a6ca3eb93a43618ce532442a89b40","analyzedAt":"2026-08-03T19:22:24.770Z","schemaVersion":2}