{"record":{"id":"806700550e7c608c","repo":"apache/druid","slug":"got-an-exception-while-loading-key-s","errorCode":null,"errorMessage":"got an exception while loading key [%s]","messagePattern":"got an exception while loading key \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions-core/lookups-cached-single/src/main/java/org/apache/druid/server/lookup/cache/loading/OffHeapLoadingCache.java","lineNumber":147,"sourceCode":"    }\n    return builder.build();\n  }\n\n  @Override\n  public V get(K key, final Callable<? extends V> valueLoader)\n  {\n    synchronized (key) {\n      V value = cache.get(key);\n      if (value != null) {\n        return value;\n      }\n      try {\n        value = valueLoader.call();\n        cache.put(key, value);\n        return value;\n      }\n      catch (Exception e) {\n        throw new ISE(e, \"got an exception while loading key [%s]\", key);\n      }\n    }\n  }\n\n\n  @Override\n  public void putAll(Map<? extends K, ? extends V> m)\n  {\n    cache.putAll(m);\n  }\n\n  @Override\n  public void invalidate(K key)\n  {\n    cache.remove(key);\n  }\n\n  @Override","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/lookups-cached-single/src/main/java/org/apache/druid/server/lookup/cache/loading/OffHeapLoadingCache.java#L129-L165","documentation":"OffHeapLoadingCache.get() invokes the user-configured valueLoader to populate the off-heap cache; if the loader throws any Exception, it is wrapped in an ISE with the offending key. The root cause is always in the underlying data feed the lookup loads from.","triggerScenarios":"A lookup's valueLoader (e.g. a map population from a URI/URL feed) throws while loading a specific key during cache population on first get().","commonSituations":"The lookup's data source (HTTP endpoint or file) is temporarily down or returns malformed data; network timeouts during first access after startup; permissions issues reading the feed.","solutions":["Inspect the wrapped cause exception to find the actual load failure (network, parse, IO)","Verify the lookup data source URL/file is reachable and returns valid data for the key","Retry once the data source is healthy; consider caching/health-checking the feed"],"exampleFix":"// before\nvalue = valueLoader.call();\n// after\ntry {\n  value = valueLoader.call();\n} catch (IOException e) {\n  log.warn(\"retrying lookup load for key %s\", key);\n  value = valueLoader.call();\n}","handlingStrategy":"retry","validationCode":"// before get(): check feed health\n// new URL(lookupUri).openConnection().connect(); // fails fast if unreachable","typeGuard":null,"tryCatchPattern":"try { return cache.get(key); } catch (ISE e) { log.error(\"lookup load failed for key {} cause {}\", key, e.getCause()); throw e.getCause() instanceof IOException ? new RetryableException(e.getCause()) : e; }","preventionTips":["Health-check the lookup data source before/while ingesting","Make the valueLoader idempotent so retries are safe","Log and monitor cause exceptions to distinguish transient (network) vs permanent (parse) failures"],"tags":["cache","lookup","loader","wrapped-exception"],"backgroundTag":"database-query-failed","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"}