apache/pulsar · error · RestException
%s %s cannot be admitted:- %s
Error message
%s %s cannot be admitted:- %s
What it means
After basic validation, registerSink runs the runtime factory's doAdmissionChecks on the FunctionDetails. If the runtime factory (e.g. Kubernetes/thread/process runtime manager) rejects the function—resource limits, namespace restrictions, instance sizing, K8s-specific constraints—the worker returns HTTP 400 with 'Sink <name> cannot be admitted:- <reason>'.
Source
Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SinksImpl.java:189
}
} catch (Exception e) {
log.error().attr("componentType", ComponentTypeUtils.toString(componentType)).attr("tenant", tenant)
.attr("namespace", namespace).attr("componentName", sinkName).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", sinkName)
.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),
sinkName, 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) {
View on GitHub (pinned to 820761864e)
Solutions
- Read the '- ' suffix in the error message and worker logs: it names the exact admission failure.
- Lower sinkConfig resources (cpu, ram, disk) and parallelism/instance count within worker limits.
- If using Kubernetes runtime, verify service account, namespace policies, and that the function image/RBAC allow scheduling.
- Adjust worker.conf admission settings (allowed runtime, resource constraints) if the policy itself is too strict.
Example fix
// before: oversized request sinkConfig.getResources().setCpu(8.0); sinkConfig.getResources().setRam(16L * 1024 * 1024 * 1024); // after: within worker admission limits sinkConfig.getResources().setCpu(0.5); sinkConfig.getResources().setRam(512L * 1024 * 1024); sinkConfig.setParallelism(1);
Defensive patterns
Strategy: validation
Validate before calling
Resources r = cfg.getResources();
if (r != null && (r.getCpu() > maxCpu || r.getRam() > maxRam)) throw new IllegalStateException("Resources exceed worker admission limits");
if (cfg.getParallelism() < 1 || cfg.getParallelism() > maxParallelism) throw new IllegalStateException("Parallelism out of allowed range"); Try / catch
try { admin.sinks().createSink(cfg, archive); } catch (PulsarAdminException e) { if (e.getStatusCode() == 400 && e.getMessage().contains("cannot be admitted")) { /* adjust resources/parallelism per the suffix message and retry */ } } Prevention
- Keep CPU/RAM/disk requests within the worker's configured function resource limits
- Match your Kubernetes runtime policies (namespace, service account, quotas) before submitting
- Read the admission reason after the ':- ' in the message
- Keep parallelism within worker-supported instance bounds
When it happens
Trigger: registerSink succeeding validation but failing doAdmissionChecks: requested CPU/RAM exceeds worker runtime limits, illegal instance count, namespace policy violations, or Kubernetes admission errors when functions-worker uses k8s runtime.
Common situations: Setting resources (cpu/ram) beyond worker's max in functionConfig; running with Kubernetes runtime but RBAC/image issues; submitting sinks with too many parallelism instances; worker config functionInstanceMinResources mismatch.
Related errors
- %s %s cannot be admitted:- %s
- Kubernetes job name size should be less than %s
- Function runtime customizer %s must implement KubernetesMani
- Unsupported Runtime %s
- Per instance CPU requested is not specified. Must specify CP
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/87102038a4dc6ec2.
Report an issue: GitHub.