{"record":{"id":"f5f9cfb09172f764","repo":"discordjs/discord.js","slug":"websocketshard-transport-compression-is-enabled","errorCode":null,"errorMessage":"WebSocketShard: transport compression is enabled, disabling identify compression","messagePattern":"WebSocketShard: transport compression is enabled, disabling identify compression","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"packages/ws/src/ws/WebSocketShard.ts","lineNumber":192,"sourceCode":"\t\t\t// cleanup hanging listeners\n\t\t\tcontroller.abort();\n\t\t}\n\n\t\tthis.initialConnectResolved = true;\n\t}\n\n\tprivate async internalConnect() {\n\t\tif (this.#status !== WebSocketShardStatus.Idle) {\n\t\t\tthrow new Error(\"Tried to connect a shard that wasn't idle\");\n\t\t}\n\n\t\tconst { version, encoding, compression, useIdentifyCompression } = this.strategy.options;\n\t\tthis.identifyCompressionEnabled = useIdentifyCompression;\n\n\t\tconst params = new URLSearchParams({ v: version, encoding });\n\t\tif (compression !== null) {\n\t\t\tif (useIdentifyCompression) {\n\t\t\t\tconsole.warn('WebSocketShard: transport compression is enabled, disabling identify compression');\n\t\t\t\tthis.identifyCompressionEnabled = false;\n\t\t\t}\n\n\t\t\tparams.append('compress', CompressionParameterMap[compression]);\n\n\t\t\tswitch (compression) {\n\t\t\t\tcase CompressionMethod.ZlibNative: {\n\t\t\t\t\tconst zlib = await getNativeZlib();\n\t\t\t\t\tif (zlib) {\n\t\t\t\t\t\tthis.inflateBuffer = [];\n\n\t\t\t\t\t\tconst inflate = zlib.createInflate({\n\t\t\t\t\t\t\tchunkSize: 65_535,\n\t\t\t\t\t\t\tflush: zlib.constants.Z_SYNC_FLUSH,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tinflate.on('data', (chunk) => {\n\t\t\t\t\t\t\tthis.inflateBuffer.push(chunk);","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/discordjs/discord.js/blob/a81ed8a306d37fdc746e26a634b6a42164ba2c8c/packages/ws/src/ws/WebSocketShard.ts#L174-L210","documentation":"This is a warning (console.warn) emitted by WebSocketShard.internalConnect when both a transport compression option (e.g. 'zlib-stream' / 'zstd-stream') and useIdentifyCompression are enabled. The Discord gateway does not allow identify payload (zlib-stream framed) compression to be combined with transport-level compression, so the shard disables identify compression and keeps transport compression. Nothing fails; the shard simply adjusts the URL 'compress' query parameter and clears this.identifyCompressionEnabled.","triggerScenarios":"Passing a WebSocketShardOptions.compression value that is not null while also setting useIdentifyCompression: true when connecting a shard (via WebSocketManager options or direct WebSocketShard.connect).","commonSituations":"Developers enabling every compression option 'to be safe' in discord.js options; copy-pasted config from examples that set both zlib-stream transport compression and identify compression; upgrading code where an older manager defaulted identify compression on and transport compression was later added.","solutions":["Remove useIdentifyCompression: true from options if you want transport compression (this is the intended setup).","Set compression: null if identify compression is what you actually want.","Ignore the warning; it is informational and the shard automatically disables identify compression.","Suppress console.warn noise only if you understand the trade-off; do not wrap in code that changes behavior."],"exampleFix":"// before\nconst manager = new WebSocketManager({\n  compression: CompressionMethod.ZlibStream,\n  useIdentifyCompression: true,\n});\n// after\nconst manager = new WebSocketManager({\n  compression: CompressionMethod.ZlibStream,\n});","handlingStrategy":"validation","validationCode":"const transportCompression = options.compression != null;\nconst identifyCompression = options.useIdentifyCompression === true;\nif (transportCompression && identifyCompression) {\n  console.warn('transport compression and useIdentifyCompression are mutually exclusive; identify compression will be disabled');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable only one compression mechanism: prefer transport compression (compression option) for large payloads.","Leave useIdentifyCompression unset unless you specifically need zlib-compressed identify payloads.","Treat this console.warn as a config-review signal in log monitoring."],"tags":["websocket","compression","configuration-conflict","discord"],"backgroundTag":"mutually-exclusive-compression-options","analyzedSha":"a81ed8a306d37fdc746e26a634b6a42164ba2c8c","analyzedAt":"2026-08-30T04:07:22.193Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}