{"record":{"id":"f3c92740871628cd","repo":"apache/druid","slug":"unsupported-content-encoding-s","errorCode":null,"errorMessage":"Unsupported content encoding [%s]","messagePattern":"Unsupported content encoding \\[(.+?)\\]","errorType":"exception","errorClass":"ISE","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/java/util/emitter/core/HttpPostEmitter.java","lineNumber":757,"sourceCode":"      long sendingStartMs = System.currentTimeMillis();\n\n      final RequestBuilder request = new RequestBuilder(\"POST\");\n      request.setUrl(url);\n      byte[] payload;\n      int payloadLength;\n      ContentEncoding contentEncoding = config.getContentEncoding();\n      if (contentEncoding != null) {\n        switch (contentEncoding) {\n          case GZIP:\n            try (GZIPOutputStream gzipOutputStream = acquireGzipOutputStream(length)) {\n              gzipOutputStream.write(buffer, 0, length);\n            }\n            payload = gzipBaos.getBuffer();\n            payloadLength = gzipBaos.size();\n            request.setHeader(HttpHeaders.Names.CONTENT_ENCODING, HttpHeaders.Values.GZIP);\n            break;\n          default:\n            throw new ISE(\"Unsupported content encoding [%s]\", contentEncoding.name());\n        }\n      } else {\n        payload = buffer;\n        payloadLength = length;\n      }\n\n      request.setHeader(HttpHeaders.Names.CONTENT_TYPE, \"application/json\");\n      request.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(payloadLength));\n      request.setBody(ByteBuffer.wrap(payload, 0, payloadLength));\n\n      if (config.getBasicAuthentication() != null) {\n        final String[] parts = config.getBasicAuthentication().getPassword().split(\":\", 2);\n        final String user = parts[0];\n        final String password = parts.length > 1 ? parts[1] : \"\";\n        String encoded = StringUtils.encodeBase64String((user + ':' + password).getBytes(StandardCharsets.UTF_8));\n        request.setHeader(HttpHeaders.Names.AUTHORIZATION, \"Basic \" + encoded);\n      }\n","sourceCodeStart":739,"sourceCodeEnd":775,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/java/util/emitter/core/HttpPostEmitter.java#L739-L775","documentation":"When HttpEmitterConfig.contentEncoding is set, the EmittingThread encodes each batch payload in a switch; only GZIP is supported besides NONE/identity. Any other configured encoding hits the default branch and throws IllegalStateException('Unsupported content encoding [%s]'). The config value failed validation at send time rather than at config load.","triggerScenarios":"Setting HttpEmitterConfig.contentEncoding to a value other than GZIP (e.g. 'gzip ' case variants handled elsewhere, DEFLATE, BR) and then emitting; copy-pasting encoding names from other HTTP clients.","commonSituations":"Users assuming compression options like deflate/brotli are supported; typos in emitter JSON config ('contentEncoding': 'GZIP ' vs other names); older configs migrated from other systems.","solutions":["Set contentEncoding to GZIP (or leave unset/identity) in HttpEmitterConfig.","Validate config values at startup; only GZIP compression is implemented.","Remove the contentEncoding field entirely if compression is not needed.","Upgrade Druid if a newly added encoding is expected — older versions support only GZIP."],"exampleFix":"// before\nHttpEmitterConfig.builder().setContentEncoding(\"DEFLATE\")...\n// after\nHttpEmitterConfig.builder().setContentEncoding(\"gzip\")...","handlingStrategy":"validation","validationCode":"HttpEmitterConfig config = ...;\nString enc = String.valueOf(config.getContentEncoding());\nif (!enc.isEmpty() && !\"GZIP\".equalsIgnoreCase(enc.trim())) {\n  throw new IllegalArgumentException(\"Only GZIP content encoding is supported, got: \" + enc);\n}","typeGuard":null,"tryCatchPattern":"try {\n  emitter.emit(event);\n} catch (IllegalStateException e) {\n  if (e.getMessage().contains(\"Unsupported content encoding\")) {\n    log.error(e, \"Fix contentEncoding in emitter config to GZIP or unset\");\n  }\n}","preventionTips":["Validate emitter config at startup, before wiring feeds","Only use GZIP (or unset) for contentEncoding","Add config schema tests for emitter JSON"],"tags":["configuration","gzip","unsupported-encoding"],"backgroundTag":"unsupported-enum-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}