{"record":{"id":"9022974e2e341777","repo":"apache/pulsar","slug":"s-s-cannot-be-admitted-s","errorCode":null,"errorMessage":"%s %s cannot be admitted:- %s","messagePattern":"(.+?) (.+?) cannot be admitted:- (.+?)","errorType":"http","errorClass":"RestException","httpStatus":400,"severity":"error","filePath":"pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java","lineNumber":190,"sourceCode":"                }\n            } catch (Exception e) {\n                log.error().attr(\"componentType\", ComponentTypeUtils.toString(componentType)).attr(\"tenant\", tenant)\n\n                        .attr(\"namespace\", namespace).attr(\"componentName\", functionName).exception(e)\n\n                        .log(\"Invalid register request @ / / /\");\n                throw new RestException(Response.Status.BAD_REQUEST, e.getMessage());\n            }\n\n            try {\n                worker().getFunctionRuntimeManager().getRuntimeFactory().doAdmissionChecks(functionDetails);\n            } catch (Exception e) {\n                log.error().attr(\"componentType\", ComponentTypeUtils.toString(componentType)).attr(\"tenant\", tenant)\n\n                        .attr(\"namespace\", namespace).attr(\"componentName\", functionName).exception(e)\n\n                        .log(\"/ / cannot be admitted by the runtime factory\");\n                throw new RestException(Response.Status.BAD_REQUEST, String.format(\"%s %s cannot be admitted:- %s\",\n                        ComponentTypeUtils.toString(componentType), functionName, e.getMessage()));\n            }\n\n            // function state\n            FunctionMetaData functionMetaDataObj = new FunctionMetaData();\n            functionMetaDataObj.setFunctionDetails().copyFrom(functionDetails);\n            functionMetaDataObj.setCreateTime(System.currentTimeMillis());\n            functionMetaDataObj.setVersion(0);\n\n            // cache auth if need\n            if (worker().getWorkerConfig().isAuthenticationEnabled()) {\n                FunctionDetails finalFunctionDetails = functionDetails;\n                worker().getFunctionRuntimeManager()\n                        .getRuntimeFactory()\n                        .getAuthProvider().ifPresent(functionAuthProvider -> {\n                    if (authParams.getClientAuthenticationDataSource() != null) {\n\n                        try {","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java#L172-L208","documentation":"Raised by FunctionsImpl.registerFunction when the Function Runtime Factory rejects the component during admission validation. The worker wraps the underlying exception in an HTTP 400 (BAD_REQUEST) RestException carrying the component type, function name, and the cause message. It means the submitted function/sink/source metadata failed runtime-admissibility checks before being persisted.","triggerScenarios":"POST to /admin/v3/functions/{tenant}/{namespace}/{functionName} (or sink/source equivalent) where FunctionConfig validation or the runtime factory's canAdmit check throws — e.g. unsupported runtime (non-Java/Python/Go), memory/cpu resources exceeding worker limits, invalid subscription name, or package URL pointing to a non-existent/unreadable artifact.","commonSituations":"Functions configured with a parallelism/resources combination exceeding the worker's functionRuntimeFactory limits; submitting a Python function to a worker built without Python support; a download URL the worker cannot fetch; typos in runtime configs copied from older configs after a Pulsar upgrade changed admission rules.","solutions":["Read the trailing detail message in the 400 response — it contains e.getMessage() of the actual admission failure and points to the violated constraint.","Adjust the FunctionConfig so it fits the worker's admission limits (resources RAM/MB, CPU, parallelism) defined in functions_worker.yml.","Verify the runtime type and its support on the worker (correct functionRuntimeFactory, installed language runtime).","Confirm the package URL (functionPkgUrl or uploaded artifact) is downloadable from the worker host.","Check worker logs for the same correlation (tenant/namespace/componentName) for the full stack trace."],"exampleFix":"// before\nFunctionConfig cfg = new FunctionConfig();\ncfg.setResources(new Resources().setRam(16L * 1024 * 1024 * 1024)); // exceeds worker admission limit\n// after\nFunctionConfig cfg = new FunctionConfig();\nResources r = new Resources();\nr.setRam(1073741824L); // within runtime factory admission limits\ncfg.setResources(r);","handlingStrategy":"validation","validationCode":"Resources r = cfg.getResources();\nlong maxRam = 8L * 1024 * 1024 * 1024; // match worker functions_worker.yml limits\nif (r != null && r.getRam() > maxRam) throw new IllegalArgumentException(\"RAM exceeds worker admission limit\");\nif (cfg.getRuntime() != FunctionConfig.Runtime.JAVA && !workerSupports(cfg.getRuntime())) {\n    throw new IllegalArgumentException(\"runtime not supported by worker\");\n}\nif (cfg.getJar() == null && cfg.getPy() == null && cfg.getGo() == null) throw new IllegalArgumentException(\"no artifact specified\");","typeGuard":null,"tryCatchPattern":"try {\n    admin.functions().createFunction(cfg, null);\n} catch (PulsarAdminException e) {\n    if (e.getStatusCode() == 400) {\n        log.error(\"Function not admitted: {}\", e.getMessage()); // message carries factory reason\n        throw new DeploymentException(cfg.getName(), e);\n    }\n    throw e;\n}","preventionTips":["Keep function resources/parallelism within the worker's declared admission limits.","Verify language runtime support on the worker cluster before deploying.","Pre-upload artifacts or use a package URL reachable from every worker host.","Re-validate configs against FunctionConfigUtils after Pulsar upgrades."],"tags":["rest-api","pulsar-functions","validation","http-400"],"backgroundTag":"function-admission-rejected","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"}