apache/pulsar · error · RestException
%s %s cannot be admitted:- %s
Error message
%s %s cannot be admitted:- %s
What it means
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.
Source
Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java:190
}
} catch (Exception e) {
log.error().attr("componentType", ComponentTypeUtils.toString(componentType)).attr("tenant", tenant)
.attr("namespace", namespace).attr("componentName", functionName).exception(e)
.log("Invalid register request @ / / /");
throw new RestException(Response.Status.BAD_REQUEST, e.getMessage());
}
try {
worker().getFunctionRuntimeManager().getRuntimeFactory().doAdmissionChecks(functionDetails);
} catch (Exception e) {
log.error().attr("componentType", ComponentTypeUtils.toString(componentType)).attr("tenant", tenant)
.attr("namespace", namespace).attr("componentName", functionName).exception(e)
.log("/ / cannot be admitted by the runtime factory");
throw new RestException(Response.Status.BAD_REQUEST, String.format("%s %s cannot be admitted:- %s",
ComponentTypeUtils.toString(componentType), functionName, e.getMessage()));
}
// function state
FunctionMetaData functionMetaDataObj = new FunctionMetaData();
functionMetaDataObj.setFunctionDetails().copyFrom(functionDetails);
functionMetaDataObj.setCreateTime(System.currentTimeMillis());
functionMetaDataObj.setVersion(0);
// cache auth if need
if (worker().getWorkerConfig().isAuthenticationEnabled()) {
FunctionDetails finalFunctionDetails = functionDetails;
worker().getFunctionRuntimeManager()
.getRuntimeFactory()
.getAuthProvider().ifPresent(functionAuthProvider -> {
if (authParams.getClientAuthenticationDataSource() != null) {
try {View on GitHub (pinned to 820761864e)
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.
Example fix
// before FunctionConfig cfg = new FunctionConfig(); cfg.setResources(new Resources().setRam(16L * 1024 * 1024 * 1024)); // exceeds worker admission limit // after FunctionConfig cfg = new FunctionConfig(); Resources r = new Resources(); r.setRam(1073741824L); // within runtime factory admission limits cfg.setResources(r);
Defensive patterns
Strategy: validation
Validate before calling
Resources r = cfg.getResources();
long maxRam = 8L * 1024 * 1024 * 1024; // match worker functions_worker.yml limits
if (r != null && r.getRam() > maxRam) throw new IllegalArgumentException("RAM exceeds worker admission limit");
if (cfg.getRuntime() != FunctionConfig.Runtime.JAVA && !workerSupports(cfg.getRuntime())) {
throw new IllegalArgumentException("runtime not supported by worker");
}
if (cfg.getJar() == null && cfg.getPy() == null && cfg.getGo() == null) throw new IllegalArgumentException("no artifact specified"); Try / catch
try {
admin.functions().createFunction(cfg, null);
} catch (PulsarAdminException e) {
if (e.getStatusCode() == 400) {
log.error("Function not admitted: {}", e.getMessage()); // message carries factory reason
throw new DeploymentException(cfg.getName(), e);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- cluster data is required
- <validation message from IllegalArgumentException>
- Tenant is not provided
- Namespace is not provided
- Function name is not provided
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/9022974e2e341777.
Report an issue: GitHub.