{"record":{"id":"c2d60ba5f193ac75","repo":"apache/pulsar","slug":"unknown-runtime","errorCode":null,"errorMessage":"Unknown runtime ","messagePattern":"Unknown runtime ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/secrets/src/main/java/org/apache/pulsar/functions/secretsproviderconfigurator/DefaultSecretsProviderConfigurator.java","lineNumber":45,"sourceCode":"\n/**\n * This is a barebones version of a secrets provider which wires in ClearTextSecretsProvider\n * to the function instances/containers.\n * While this is the default configurator, it is highly recommended that for real-security\n * you use some alternate provider.\n */\npublic class DefaultSecretsProviderConfigurator implements SecretsProviderConfigurator {\n    @Override\n    public String getSecretsProviderClassName(FunctionDetails functionDetails) {\n        switch (functionDetails.getRuntime()) {\n            case JAVA:\n                return ClearTextSecretsProvider.class.getName();\n            case PYTHON:\n                return \"secretsprovider.ClearTextSecretsProvider\";\n            case GO:\n                return \"\";\n            default:\n                throw new RuntimeException(\"Unknown runtime \" + functionDetails.getRuntime());\n        }\n    }\n\n    @Override\n    public Map<String, String> getSecretsProviderConfig(FunctionDetails functionDetails) {\n        return null;\n    }\n\n    @Override\n    public void configureKubernetesRuntimeSecretsProvider(V1PodSpec podSpec, String functionsContainerName,\n                                                          FunctionDetails functionDetails) {\n        // noop\n    }\n\n    @Override\n    public void configureProcessRuntimeSecretsProvider(ProcessBuilder processBuilder,\n                                                       FunctionDetails functionDetails) {\n        // noop","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/secrets/src/main/java/org/apache/pulsar/functions/secretsproviderconfigurator/DefaultSecretsProviderConfigurator.java#L27-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set an explicit, supported runtime (JAVA, PYTHON or GO) when creating/submitting the function.","Align Pulsar function worker and broker versions so enum values match across components.","Check the FunctionDetails proto value being sent (runtime field) — 0/unset means it was never specified.","For new runtime types, extend DefaultSecretsProviderConfigurator to handle the enum case."],"exampleFix":"// before (runtime omitted)\nFunctionDetails.newBuilder().setClassName(\"...\").build()\n// after\nFunctionDetails.newBuilder().setClassName(\"...\").setRuntime(FunctionDetails.Runtime.JAVA).build()","handlingStrategy":"validation","validationCode":"FunctionDetails.Runtime rt = functionDetails.getRuntime();\nif (rt == null || rt == FunctionDetails.Runtime.RUNTIME_UNSPECIFIED) {\n  throw new IllegalArgumentException(\"Function runtime must be set explicitly (JAVA/PYTHON/GO)\");\n}","typeGuard":"boolean isKnownRuntime(FunctionDetails d) { switch (d.getRuntime()) { case JAVA: case PYTHON: case GO: return true; default: return false; } }","tryCatchPattern":"try { String cls = configurator.getSecretsProviderClassName(functionDetails); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"Unknown runtime\")) { log.error(\"Unsupported runtime enum {}\", functionDetails.getRuntime()); } throw e; }","preventionTips":["Always set the runtime explicitly when submitting functions.","Keep function worker and broker versions aligned.","Validate FunctionDetails proto before dispatch to the secrets configurator.","Update the configurator switch when new runtime types are introduced."],"tags":["function-runtime","enum","secrets-provider","configuration"],"backgroundTag":"unknown-runtime","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"}