apache/pulsar · error · RuntimeException
Thread Container only supports Java Runtime
Error message
Thread Container only supports Java Runtime
What it means
The ThreadRuntime constructor enforces that thread-based execution only supports Java functions: if instanceConfig.getFunctionDetails().getRuntime() != FunctionDetails.Runtime.JAVA it immediately throws RuntimeException('Thread Container only supports Java Runtime'). Thread containers run the function in-process, which is impossible for Python/Go functions.
Source
Thrown at pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/thread/ThreadRuntime.java:95
ThreadRuntime(InstanceConfig instanceConfig,
FunctionCacheManager fnCache,
ThreadGroup threadGroup,
String jarFile,
String transformFunctionFile,
PulsarClient client,
ClientBuilder clientBuilder,
PulsarAdmin pulsarAdmin,
String stateStorageImplClass,
String stateStorageServiceUrl,
SecretsProvider secretsProvider,
FunctionCollectorRegistry collectorRegistry,
String narExtractionDirectory,
Optional<ConnectorsManager> connectorsManager,
Optional<FunctionsManager> functionsManager) {
this.instanceConfig = instanceConfig;
if (instanceConfig.getFunctionDetails().getRuntime() != FunctionDetails.Runtime.JAVA) {
throw new RuntimeException("Thread Container only supports Java Runtime");
}
this.threadGroup = threadGroup;
this.fnCache = fnCache;
this.jarFile = jarFile;
this.transformFunctionFile = transformFunctionFile;
this.clientBuilder = clientBuilder;
this.pulsarClient = client;
this.pulsarAdmin = pulsarAdmin;
this.stateStorageImplClass = stateStorageImplClass;
this.stateStorageServiceUrl = stateStorageServiceUrl;
this.secretsProvider = secretsProvider;
this.collectorRegistry = collectorRegistry;
this.narExtractionDirectory = narExtractionDirectory;
this.connectorsManager = connectorsManager;
this.functionsManager = functionsManager;
}
View on GitHub (pinned to 820761864e)
Solutions
- Switch the function worker to the PROCESS or KUBERNETES runtime factory, which supports Python and Go functions.
- Resubmit the function as a Java function if the thread runtime must stay.
- Route non-Java functions to a different worker cluster configured with a compatible runtime factory.
- Document/enforce runtime policy per cluster so users do not submit Python/Go functions to thread-runtime workers.
Example fix
# before (worker config) functionRuntimeFactoryClassName: org.apache.pulsar.functions.runtime.thread.ThreadRuntimeFactory # after functionRuntimeFactoryClassName: org.apache.pulsar.functions.runtime.process.ProcessRuntimeFactory
Defensive patterns
Strategy: validation
Validate before calling
if (instanceConfig.getFunctionDetails().getRuntime() != FunctionDetails.Runtime.JAVA) {
throw new IllegalArgumentException("Thread runtime workers accept JAVA functions only; use PROCESS/KUBERNETES runtime for "
+ instanceConfig.getFunctionDetails().getRuntime());
} Type guard
boolean isThreadRuntimeCompatible(FunctionDetails details) {
return details != null && details.getRuntime() == FunctionDetails.Runtime.JAVA;
} Try / catch
try {
ThreadRuntime rt = new ThreadRuntime(...);
} catch (RuntimeException e) {
if ("Thread Container only supports Java Runtime".equals(e.getMessage())) {
// re-route this function to a PROCESS/KUBERNETES worker
}
throw e;
} Prevention
- Match worker runtime factory to the function languages the cluster will host.
- Route Python/Go functions to PROCESS or KUBERNETES runtime workers.
- Enforce runtime policy at submission time via admission hooks.
When it happens
Trigger: Configuring the function worker with functionRuntimeFactoryOptions / ThreadRuntime (thread container) while submitting or scheduling a function whose runtime is PYTHON or GO (or anything non-JAVA); constructing ThreadRuntime directly with a non-JAVA InstanceConfig.
Common situations: Worker left on the default THREAD runtime after the team starts deploying Python functions; a tenant submitting a non-Java function to a thread-runtime-only worker; copying worker configs between clusters where the other cluster used PROCESS/Kubernetes runtime.
Related errors
- Unknown component type: %s
- Access to environment variable %s is not allowed.
- PulsarAdmin is not enabled in function worker
- Getting consumer is not supported
- Not support component type
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/cb0244a08bf996de.
Report an issue: GitHub.