apache/pulsar · error · RuntimeException

Unknown function runtime

Error message

Unknown function runtime 

What it means

KubernetesSecretsProviderConfigurator.getSecretsProviderClassName() maps JAVA/PYTHON runtimes to environment-based secrets providers; any other runtime value falls into default and throws RuntimeException("Unknown function runtime ..."). GO returns "" pending GH issue #8425, so the throw fires only for values outside the known switch.

Source

Thrown at pulsar-functions/secrets/src/main/java/org/apache/pulsar/functions/secretsproviderconfigurator/KubernetesSecretsProviderConfigurator.java:58

 * to ensure that the secrets are available to the function at runtime. Then we plug in the
 * EnvironmentBasedSecretsConfig as the secrets provider who knows how to read these environment variables.
 */
public class KubernetesSecretsProviderConfigurator implements SecretsProviderConfigurator {
    private static String idKey = "path";
    private static String keyKey = "key";

    @Override
    public String getSecretsProviderClassName(FunctionDetails functionDetails) {
        switch (functionDetails.getRuntime()) {
            case JAVA:
                return EnvironmentBasedSecretsProvider.class.getName();
            case PYTHON:
                return "secretsprovider.EnvironmentBasedSecretsProvider";
            case GO:
                // [TODO] See GH issue #8425, we should finish this part once the issue is resolved.
                return "";
            default:
                throw new RuntimeException("Unknown function runtime " + functionDetails.getRuntime());
        }
    }

    @Override
    public Map<String, String> getSecretsProviderConfig(FunctionDetails functionDetails) {
        return null;
    }

    // Kubernetes secrets can be exposed as volume mounts or as
    // environment variables in the pods. We are currently using the
    // environment variables way. Essentially the secretName/secretPath
    // is attached as secretRef to the environment variables
    // of a pod and kubernetes magically makes the secret pointed to by this combination available as a env variable.
    @Override
    public void configureKubernetesRuntimeSecretsProvider(V1PodSpec podSpec, String functionsContainerName,
                                                          FunctionDetails functionDetails) {
        V1Container container = null;
        for (V1Container v1Container : podSpec.getContainers()) {

View on GitHub (pinned to 820761864e)

Solutions

  1. Set runtime explicitly to JAVA or PYTHON when submitting the function for a Kubernetes deployment.
  2. Upgrade/downgrade function worker so the Runtime enum matches the one used at submission.
  3. Validate the submitted FunctionDetails proto (runtime field) before dispatch.
  4. Extend the configurator's switch if a new runtime type was introduced.

Example fix

// before
.setRuntime(FunctionDetails.Runtime.RUNTIME_UNSPECIFIED)
// after
.setRuntime(FunctionDetails.Runtime.JAVA)
Defensive patterns

Strategy: validation

Validate before calling

FunctionDetails.Runtime rt = functionDetails.getRuntime();
if (rt != FunctionDetails.Runtime.JAVA && rt != FunctionDetails.Runtime.PYTHON && rt != FunctionDetails.Runtime.GO) {
  throw new IllegalArgumentException("Kubernetes secrets provider supports JAVA/PYTHON/GO only, got: " + rt);
}

Type guard

boolean k8sSecretsSupported(FunctionDetails d) { switch (d.getRuntime()) { case JAVA: case PYTHON: case GO: return true; default: return false; } }

Try / catch

try { String cls = k8sConfigurator.getSecretsProviderClassName(functionDetails); } catch (RuntimeException e) { if (e.getMessage().startsWith("Unknown function runtime")) { log.error("Runtime {} unknown to this worker; check version skew", functionDetails.getRuntime()); } throw e; }

Prevention

When it happens

Trigger: Invoking getSecretsProviderClassName with a FunctionDetails having an unrecognized runtime enum (unset/unspecified or a newer runtime value unknown to this configurator) while running functions on Kubernetes with the Kubernetes secrets provider configurator.

Common situations: Version skew between function worker and function proto definitions; functions submitted with runtime left defaulted; custom runtime values in patched builds.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/062bcacb5d5056e8. Report an issue: GitHub.