apache/druid · error · IllegalArgumentException
Unknown format [ ]
Error message
Unknown format [%s]
What it means
Thrown when deserializing a search-query result object from cache: the pullObject map function expects the cached input to be a Map or a SearchHit, and any other type fails with IAE('Unknown format [%s]'). This means the cached payload has an unexpected shape for the search toolchest. It usually signals cache corruption or a cache written by a different Druid version.
Solutions
- Clear the Druid cache (segment and query caches) after upgrading versions
- Verify cache configuration (type, key serialization) matches expected search-result formats
- Reproduce without cache (set useCache/populateCache=false) to confirm the cache is the source
Example fix
// before
query context: {"useCache": true} // with stale cache entries
// after
flush cache, then: {"useCache": true, "populateCache": true} // with regenerated entries Defensive patterns
Strategy: validation
Validate before calling
if (!(input instanceof Map) && !(input instanceof SearchHit)) { throw new IllegalStateException("bad cache entry: " + input.getClass()); } Type guard
boolean isDecodableSearchResult(Object o) { return o instanceof Map || o instanceof SearchHit; } Try / catch
try { hit = decoder.apply(input); } catch (IAE e) { log.warn("invalid cached search result, skipping cache", e); fallbackToSegmentScan(); } Prevention
- Flush query caches on Druid upgrades
- Validate cache backends preserve object type/serialization
- Test search queries with cache disabled when seeing decode errors
When it happens
Trigger: Reading search-query results from cache where the entry is neither a Map nor a SearchHit; a stale/corrupted cache entry or cache written by an incompatible Druid version; cache level misconfiguration delivering raw/non-cached objects.
Common situations: Upgrading Druid without flushing an old segment-result cache; cache-population bugs in custom caching layers; local cache files corrupted on disk.
Related errors
- Can only handle [ ], got [ ]
- Cannot add / to a Spectator Histogram
- Cannot create type [ ]
- Cannot deserialize type
- Failed to retrieve results from cache for query ID
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/773bf221cbc9433f.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/query/search/SearchQueryQueryToolChest.java:243
new Function<Object, SearchHit>()
{
@Override
public SearchHit apply(@Nullable Object input)
{
String dim;
String val;
Integer count;
if (input instanceof Map) {
dim = outputNameMap.get((String) ((Map) input).get("dimension"));
val = (String) ((Map) input).get("value");
count = (Integer) ((Map) input).get("count");
} else if (input instanceof SearchHit) {
SearchHit cached = (SearchHit) input;
dim = outputNameMap.get(cached.getDimension());
val = cached.getValue();
count = cached.getCount();
} else {
throw new IAE("Unknown format [%s]", input.getClass());
}
return new SearchHit(dim, val, count);
}
}
)
)
);
} else {
return new Result<>(
DateTimes.utc(((Number) result.get(0)).longValue()),
new SearchResultValue(
Lists.transform(
(List) result.get(1),
new Function<Object, SearchHit>()
{
@Override
public SearchHit apply(@Nullable Object input)
{View on GitHub (pinned to 9b90983fd2)