{"record":{"id":"773bf221cbc9433f","repo":"apache/druid","slug":"unknown-format-s","errorCode":null,"errorMessage":"Unknown format [%s]","messagePattern":"Unknown format \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/query/search/SearchQueryQueryToolChest.java","lineNumber":243,"sourceCode":"                          new Function<Object, SearchHit>()\n                          {\n                            @Override\n                            public SearchHit apply(@Nullable Object input)\n                            {\n                              String dim;\n                              String val;\n                              Integer count;\n                              if (input instanceof Map) {\n                                dim = outputNameMap.get((String) ((Map) input).get(\"dimension\"));\n                                val = (String) ((Map) input).get(\"value\");\n                                count = (Integer) ((Map) input).get(\"count\");\n                              } else if (input instanceof SearchHit) {\n                                SearchHit cached = (SearchHit) input;\n                                dim = outputNameMap.get(cached.getDimension());\n                                val = cached.getValue();\n                                count = cached.getCount();\n                              } else {\n                                throw new IAE(\"Unknown format [%s]\", input.getClass());\n                              }\n                              return new SearchHit(dim, val, count);\n                            }\n                          }\n                      )\n                  )\n              );\n            } else {\n              return new Result<>(\n                  DateTimes.utc(((Number) result.get(0)).longValue()),\n                  new SearchResultValue(\n                      Lists.transform(\n                          (List) result.get(1),\n                          new Function<Object, SearchHit>()\n                          {\n                            @Override\n                            public SearchHit apply(@Nullable Object input)\n                            {","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/query/search/SearchQueryQueryToolChest.java#L225-L261","documentation":"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.","triggerScenarios":"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.","commonSituations":"Upgrading Druid without flushing an old segment-result cache; cache-population bugs in custom caching layers; local cache files corrupted on disk.","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"],"exampleFix":"// before\nquery context: {\"useCache\": true} // with stale cache entries\n// after\nflush cache, then: {\"useCache\": true, \"populateCache\": true} // with regenerated entries","handlingStrategy":"validation","validationCode":"if (!(input instanceof Map) && !(input instanceof SearchHit)) { throw new IllegalStateException(\"bad cache entry: \" + input.getClass()); }","typeGuard":"boolean isDecodableSearchResult(Object o) { return o instanceof Map || o instanceof SearchHit; }","tryCatchPattern":"try { hit = decoder.apply(input); } catch (IAE e) { log.warn(\"invalid cached search result, skipping cache\", e); fallbackToSegmentScan(); }","preventionTips":["Flush query caches on Druid upgrades","Validate cache backends preserve object type/serialization","Test search queries with cache disabled when seeing decode errors"],"tags":["cache","deserialization","search-query","type-mismatch"],"backgroundTag":"unexpected-response-shape","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"}