{"record":{"id":"8b4dc3b57eba6807","repo":"discordjs/discord.js","slug":"no-compatible-encryption-modes-available-include","errorCode":null,"errorMessage":"No compatible encryption modes. Available include: ${options.join(', ')}","messagePattern":"No compatible encryption modes\\. Available include: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/voice/src/networking/Networking.ts","lineNumber":215,"sourceCode":" */\nfunction stringifyState(state: NetworkingState) {\n\treturn JSON.stringify({\n\t\t...state,\n\t\tws: Reflect.has(state, 'ws'),\n\t\tudp: Reflect.has(state, 'udp'),\n\t});\n}\n\n/**\n * Chooses an encryption mode from a list of given options. Chooses the most preferred option.\n *\n * @param options - The available encryption options\n */\nfunction chooseEncryptionMode(options: VoiceEncryptionMode[]): VoiceEncryptionMode {\n\tconst option = options.find((option) => SUPPORTED_ENCRYPTION_MODES.includes(option));\n\tif (!option) {\n\t\t// This should only ever happen if the gateway does not give us any encryption modes we support.\n\t\tthrow new Error(`No compatible encryption modes. Available include: ${options.join(', ')}`);\n\t}\n\n\treturn option;\n}\n\n/**\n * Returns a random number that is in the range of n bits.\n *\n * @param numberOfBits - The number of bits\n */\nfunction randomNBit(numberOfBits: number) {\n\treturn Math.floor(Math.random() * 2 ** numberOfBits);\n}\n\n/**\n * Manages the networking required to maintain a voice connection and dispatch audio packets\n */\nexport class Networking extends EventEmitter {","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/discordjs/discord.js/blob/a81ed8a306d37fdc746e26a634b6a42164ba2c8c/packages/voice/src/networking/Networking.ts#L197-L233","documentation":"During voice connection setup, chooseEncryptionMode() picks the first server-offered encryption mode that appears in SUPPORTED_ENCRYPTION_MODES. If the voice gateway offers none of the supported modes, the library throws, since secure transport is mandatory.","triggerScenarios":"The Discord voice server's select_protocol/description returns VoiceEncryptionMode values (e.g. xsalsa20_poly1305 variants) none of which the installed library supports — typically when the gateway only offers deprecated modes (xsalsa20_poly1305, xsalsa20_poly1305_suffix, xsalsa20_poly1305_post) while the installed @discordjs/voice only supports aead_xchacha20_poly1305_rtpsize (or vice versa with an old library).","commonSituations":"Outdated @discordjs/voice after Discord deprecated old encryption modes; very new library against a stale/proxy voice gateway; custom self-hosted/patched voice servers offering unsupported modes.","solutions":["Update @discordjs/voice (and discord.js) to the latest version so modern modes like aead_xchacha20_poly1305_rtpsize are supported","If constrained to an old environment, install the @snazzah (sodium-native/libsodium-wrappers or tweetnacl) crypto dependency set matching your library version's SUPPORTED_ENCRYPTION_MODES","Check that no proxy/custom voice gateway is stripping the supported modes from the offer","Log the offered modes from the error message and compare against your library's SUPPORTED_ENCRYPTION_MODES"],"exampleFix":"// before (old lib, only legacy modes offered)\n// \"No compatible encryption modes. Available include: xsalsa20_poly1305\"\nnpm i @discordjs/voice@latest\n// after: library supports aead_xchacha20_poly1305_rtpsize and connects","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { connect(); } catch (e) { if (e.message.startsWith('No compatible encryption modes')) { await updateOrReconnectWithSupportedModes(); } else throw e; }","preventionTips":["Keep @discordjs/voice updated so modern encryption modes (aead_xchacha20_poly1305_rtpsize) are supported","Install the required sodium/crypto packages for your platform","Compare the offered modes in the error message against SUPPORTED_ENCRYPTION_MODES","Avoid proxies/custom voice servers that strip supported modes"],"tags":["voice","encryption","network","version-mismatch"],"backgroundTag":"no-supported-encryption-mode","analyzedSha":"a81ed8a306d37fdc746e26a634b6a42164ba2c8c","analyzedAt":"2026-08-30T04:07:22.193Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}