{"record":{"id":"cb0244a08bf996de","repo":"apache/pulsar","slug":"thread-container-only-supports-java-runtime","errorCode":null,"errorMessage":"Thread Container only supports Java Runtime","messagePattern":"Thread Container only supports Java Runtime","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/thread/ThreadRuntime.java","lineNumber":95,"sourceCode":"\n    ThreadRuntime(InstanceConfig instanceConfig,\n                  FunctionCacheManager fnCache,\n                  ThreadGroup threadGroup,\n                  String jarFile,\n                  String transformFunctionFile,\n                  PulsarClient client,\n                  ClientBuilder clientBuilder,\n                  PulsarAdmin pulsarAdmin,\n                  String stateStorageImplClass,\n                  String stateStorageServiceUrl,\n                  SecretsProvider secretsProvider,\n                  FunctionCollectorRegistry collectorRegistry,\n                  String narExtractionDirectory,\n                  Optional<ConnectorsManager> connectorsManager,\n                  Optional<FunctionsManager> functionsManager) {\n        this.instanceConfig = instanceConfig;\n        if (instanceConfig.getFunctionDetails().getRuntime() != FunctionDetails.Runtime.JAVA) {\n            throw new RuntimeException(\"Thread Container only supports Java Runtime\");\n        }\n\n        this.threadGroup = threadGroup;\n        this.fnCache = fnCache;\n        this.jarFile = jarFile;\n        this.transformFunctionFile = transformFunctionFile;\n        this.clientBuilder = clientBuilder;\n        this.pulsarClient = client;\n        this.pulsarAdmin = pulsarAdmin;\n        this.stateStorageImplClass = stateStorageImplClass;\n        this.stateStorageServiceUrl = stateStorageServiceUrl;\n        this.secretsProvider = secretsProvider;\n        this.collectorRegistry = collectorRegistry;\n        this.narExtractionDirectory = narExtractionDirectory;\n        this.connectorsManager = connectorsManager;\n        this.functionsManager = functionsManager;\n    }\n","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/thread/ThreadRuntime.java#L77-L113","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before (worker config)\nfunctionRuntimeFactoryClassName: org.apache.pulsar.functions.runtime.thread.ThreadRuntimeFactory\n# after\nfunctionRuntimeFactoryClassName: org.apache.pulsar.functions.runtime.process.ProcessRuntimeFactory","handlingStrategy":"validation","validationCode":"if (instanceConfig.getFunctionDetails().getRuntime() != FunctionDetails.Runtime.JAVA) {\n    throw new IllegalArgumentException(\"Thread runtime workers accept JAVA functions only; use PROCESS/KUBERNETES runtime for \"\n        + instanceConfig.getFunctionDetails().getRuntime());\n}","typeGuard":"boolean isThreadRuntimeCompatible(FunctionDetails details) {\n    return details != null && details.getRuntime() == FunctionDetails.Runtime.JAVA;\n}","tryCatchPattern":"try {\n    ThreadRuntime rt = new ThreadRuntime(...);\n} catch (RuntimeException e) {\n    if (\"Thread Container only supports Java Runtime\".equals(e.getMessage())) {\n        // re-route this function to a PROCESS/KUBERNETES worker\n    }\n    throw e;\n}","preventionTips":["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."],"tags":["pulsar-functions","runtime","configuration"],"backgroundTag":"unsupported-runtime-type","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}