apache/pulsar · error · RuntimeException

Unrecognized runtime:

Error message

Unrecognized runtime: 

What it means

FunctionCommon.convertRuntime(FunctionConfig.Runtime) maps the functions-config runtime enum to the internal Runtime enum by matching enum constant names. If the config's runtime name matches no internal Runtime constant, this RuntimeException naming the runtime is thrown. In practice both enums are normally aligned, so this fires mainly when they drift apart across versions.

Source

Thrown at pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionCommon.java:168

            } else {
                return java.util.function.Function.class;
            }
        } else {
            if (userClass.asErasure().isAssignableTo(Function.class)) {
                return Function.class;
            } else {
                return java.util.function.Function.class;
            }
        }
    }

    public static Runtime convertRuntime(FunctionConfig.Runtime runtime) {
        for (Runtime type : Runtime.values()) {
            if (type.name().equals(runtime.name())) {
                return type;
            }
        }
        throw new RuntimeException("Unrecognized runtime: " + runtime.name());
    }

    public static FunctionConfig.Runtime convertRuntime(Runtime runtime) {
        for (FunctionConfig.Runtime type : FunctionConfig.Runtime.values()) {
            if (type.name().equals(runtime.name())) {
                return type;
            }
        }
        throw new RuntimeException("Unrecognized runtime: " + runtime.name());
    }

    public static ProcessingGuarantees convertProcessingGuarantee(
            FunctionConfig.ProcessingGuarantees processingGuarantees) {
        for (ProcessingGuarantees type :
                ProcessingGuarantees
                .values()) {
            if (type.name().equals(processingGuarantees.name())) {
                return type;

View on GitHub (pinned to 820761864e)

Solutions

  1. Upgrade the broker/functions-worker so its Runtime enum supports the config's runtime value
  2. Resubmit the function with a supported runtime (JAVA, PYTHON, GO as available in your version)
  3. Regenerate the function config with a matching CLI/server version

Example fix

// before
"runtime": "GOYAML" // unrecognized
// after
"runtime": "GO" // supported in the deployed Pulsar version
Defensive patterns

Strategy: validation

Validate before calling

// Check the runtime name is supported before submission
Set<String> supported = Arrays.stream(FunctionCommon.Runtime.values())
    .map(Enum::name).collect(Collectors.toSet());
if (!supported.contains(config.getRuntime().name()))
    throw new IllegalArgumentException("Runtime " + config.getRuntime() + " not supported by this broker version");

Type guard

boolean isSupportedRuntime(FunctionConfig.Runtime r) {
    return r == FunctionConfig.Runtime.JAVA
        || r == FunctionConfig.Runtime.PYTHON
        || r == FunctionConfig.Runtime.GO;
}

Try / catch

try {
    Runtime rt = FunctionCommon.convertRuntime(config.getRuntime());
} catch (RuntimeException e) {
    log.error("Config runtime not recognized by this worker build: " + config.getRuntime(), e);
    throw new IllegalArgumentException("Unsupported runtime; upgrade broker or use JAVA/PYTHON/GO", e);
}

Prevention

When it happens

Trigger: Calling convertRuntime with a FunctionConfig.Runtime value whose name() has no counterpart in the internal Runtime enum — e.g. JAVA/PYTHON handled but a newer runtime (GO) missing in the deployed build, or a config enum with an extra/renamed constant.

Common situations: Configs generated by a newer CLI/client (introducing a new runtime type) submitted to an older broker/worker; renamed enum constants during upgrades; hand-constructed configs with unusual runtime values.

Related errors


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