apache/druid · error · ISE
Unsupported content encoding
Error message
Unsupported content encoding [%s]
What it means
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.
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.
Example fix
// before
HttpEmitterConfig.builder().setContentEncoding("DEFLATE")...
// after
HttpEmitterConfig.builder().setContentEncoding("gzip")... Defensive patterns
Strategy: validation
Validate before calling
HttpEmitterConfig config = ...;
String enc = String.valueOf(config.getContentEncoding());
if (!enc.isEmpty() && !"GZIP".equalsIgnoreCase(enc.trim())) {
throw new IllegalArgumentException("Only GZIP content encoding is supported, got: " + enc);
} Try / catch
try {
emitter.emit(event);
} catch (IllegalStateException e) {
if (e.getMessage().contains("Unsupported content encoding")) {
log.error(e, "Fix contentEncoding in emitter config to GZIP or unset");
}
} Prevention
- Validate emitter config at startup, before wiring feeds
- Only use GZIP (or unset) for contentEncoding
- Add config schema tests for emitter JSON
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- A valid tlsPort needs to specified when druid.enableTlsPort…
- At least one of the druid.enablePlaintextPort or…
- At least one task runner must be enabled
- At most one of 'druid.broker.segment.watchedTiers' and…
- Backfill tasks require 'useConcurrentLocks' to be set to…
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/f3c92740871628cd.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/java/util/emitter/core/HttpPostEmitter.java:757
long sendingStartMs = System.currentTimeMillis();
final RequestBuilder request = new RequestBuilder("POST");
request.setUrl(url);
byte[] payload;
int payloadLength;
ContentEncoding contentEncoding = config.getContentEncoding();
if (contentEncoding != null) {
switch (contentEncoding) {
case GZIP:
try (GZIPOutputStream gzipOutputStream = acquireGzipOutputStream(length)) {
gzipOutputStream.write(buffer, 0, length);
}
payload = gzipBaos.getBuffer();
payloadLength = gzipBaos.size();
request.setHeader(HttpHeaders.Names.CONTENT_ENCODING, HttpHeaders.Values.GZIP);
break;
default:
throw new ISE("Unsupported content encoding [%s]", contentEncoding.name());
}
} else {
payload = buffer;
payloadLength = length;
}
request.setHeader(HttpHeaders.Names.CONTENT_TYPE, "application/json");
request.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(payloadLength));
request.setBody(ByteBuffer.wrap(payload, 0, payloadLength));
if (config.getBasicAuthentication() != null) {
final String[] parts = config.getBasicAuthentication().getPassword().split(":", 2);
final String user = parts[0];
final String password = parts.length > 1 ? parts[1] : "";
String encoded = StringUtils.encodeBase64String((user + ':' + password).getBytes(StandardCharsets.UTF_8));
request.setHeader(HttpHeaders.Names.AUTHORIZATION, "Basic " + encoded);
}
View on GitHub (pinned to 9b90983fd2)