apache/druid · error · IllegalStateException
Cannot find generator for namespace
Error message
Cannot find generator for namespace [%s]
What it means
CacheScheduler.schedule() looks up a CacheGenerator by the namespace's concrete class in namespaceGeneratorMap. If no generator was registered for that ExtractionNamespace type, schedule() cannot create the entry and throws this ISE naming the namespace.
Solutions
- Use a supported namespace type (JdbcExtractionNamespace, UriExtractionNamespace, etc.).
- If custom, register your CacheGenerator for the namespace class when constructing CacheScheduler.
- Load the extension module that provides the generator for the namespace type.
Example fix
// before
scheduler.schedule(new MyCustomNamespace(...)); // ISE: no generator
// after
// in scheduler construction:
new CacheScheduler(..., ImmutableMap.of(
JdbcExtractionNamespace.class, new JdbcCacheGenerator(...),
UriExtractionNamespace.class, new UriCacheGenerator(...),
MyCustomNamespace.class, myGenerator)); Defensive patterns
Strategy: validation
Validate before calling
Set<Class<?>> supported = Set.of(JdbcExtractionNamespace.class, UriExtractionNamespace.class);
if (!supported.contains(namespace.getClass())) throw new IllegalArgumentException("Unsupported namespace type: " + namespace.getClass()); Type guard
boolean schedulable(ExtractionNamespace n) { return n instanceof JdbcExtractionNamespace || n instanceof UriExtractionNamespace; } Try / catch
try { return scheduler.schedule(namespace); } catch (IllegalStateException e) { if (e.getMessage().startsWith("Cannot find generator for namespace")) { /* register generator or load extension */ } else { throw e; } } Prevention
- Register a CacheGenerator for every custom namespace class
- Load the extension module that supports the namespace type
When it happens
Trigger: Calling scheduler.schedule(namespace) with an ExtractionNamespace subclass that has no registered CacheGenerator (e.g. a custom namespace type not wired into the scheduler, or an extension namespace whose module wasn't loaded).
Common situations: Custom ExtractionNamespace implementation without registering its generator in the scheduler's constructor; using a lookup type provided by an extension that isn't loaded; reflection-created namespace objects with a type not supported in this runtime.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Already shut down, not starting again
- Already started, not starting again
- Cache reference is null
- can't start.
- can't stop.
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/2aed94b6dec99544.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-core/lookups-cached-global/src/main/java/org/apache/druid/server/lookup/namespace/cache/CacheScheduler.java:530
finally {
if (!success) {
// ExecutionException's cause is logged in entry.close()
entry.close();
if (loadException != null) {
log.error(loadException, "CacheScheduler[%s] - problem during start or waiting for the first run", entry);
} else {
log.error("CacheScheduler[%s] - problem during start or waiting for the first run", entry);
}
}
}
}
public <T extends ExtractionNamespace> Entry schedule(final T namespace)
{
@SuppressWarnings("unchecked")
final CacheGenerator<T> generator = (CacheGenerator<T>) namespaceGeneratorMap.get(namespace.getClass());
if (generator == null) {
throw new ISE("Cannot find generator for namespace [%s]", namespace);
}
return new Entry<>(namespace, generator);
}
}
View on GitHub (pinned to 9b90983fd2)