apache/pulsar · error · RuntimeException

Unknown runtime

Error message

Unknown runtime 

What it means

DefaultSecretsProviderConfigurator.getSecretsProviderClassName() switches on functionDetails.getRuntime() (JAVA, PYTHON, GO). Any other/unrecognized runtime enum value falls into default and throws RuntimeException("Unknown runtime ..."). GO intentionally returns "" (no provider yet) — only non-switchable values hit the throw.

Source

Thrown at pulsar-functions/secrets/src/main/java/org/apache/pulsar/functions/secretsproviderconfigurator/DefaultSecretsProviderConfigurator.java:45

/**
 * This is a barebones version of a secrets provider which wires in ClearTextSecretsProvider
 * to the function instances/containers.
 * While this is the default configurator, it is highly recommended that for real-security
 * you use some alternate provider.
 */
public class DefaultSecretsProviderConfigurator implements SecretsProviderConfigurator {
    @Override
    public String getSecretsProviderClassName(FunctionDetails functionDetails) {
        switch (functionDetails.getRuntime()) {
            case JAVA:
                return ClearTextSecretsProvider.class.getName();
            case PYTHON:
                return "secretsprovider.ClearTextSecretsProvider";
            case GO:
                return "";
            default:
                throw new RuntimeException("Unknown runtime " + functionDetails.getRuntime());
        }
    }

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

    @Override
    public void configureKubernetesRuntimeSecretsProvider(V1PodSpec podSpec, String functionsContainerName,
                                                          FunctionDetails functionDetails) {
        // noop
    }

    @Override
    public void configureProcessRuntimeSecretsProvider(ProcessBuilder processBuilder,
                                                       FunctionDetails functionDetails) {
        // noop

View on GitHub (pinned to 820761864e)

Solutions

  1. Set an explicit, supported runtime (JAVA, PYTHON or GO) when creating/submitting the function.
  2. Align Pulsar function worker and broker versions so enum values match across components.
  3. Check the FunctionDetails proto value being sent (runtime field) — 0/unset means it was never specified.
  4. For new runtime types, extend DefaultSecretsProviderConfigurator to handle the enum case.

Example fix

// before (runtime omitted)
FunctionDetails.newBuilder().setClassName("...").build()
// after
FunctionDetails.newBuilder().setClassName("...").setRuntime(FunctionDetails.Runtime.JAVA).build()
Defensive patterns

Strategy: validation

Validate before calling

FunctionDetails.Runtime rt = functionDetails.getRuntime();
if (rt == null || rt == FunctionDetails.Runtime.RUNTIME_UNSPECIFIED) {
  throw new IllegalArgumentException("Function runtime must be set explicitly (JAVA/PYTHON/GO)");
}

Type guard

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

Try / catch

try { String cls = configurator.getSecretsProviderClassName(functionDetails); } catch (RuntimeException e) { if (e.getMessage().startsWith("Unknown runtime")) { log.error("Unsupported runtime enum {}", functionDetails.getRuntime()); } throw e; }

Prevention

When it happens

Trigger: Calling getSecretsProviderClassName with a FunctionDetails whose Runtime enum is a newer value (e.g. added in a newer Pulsar) not known to this configurator, or a default/unset runtime (RUNTIME_UNSPECIFIED/None) passed through.

Common situations: Mixed-version clusters where broker/worker versions disagree about the Runtime enum; programmatically constructed FunctionDetails with runtime left unset; proto defaults (runtime 0) when the field was never populated.

Related errors


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