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

  1. Read the '- ' suffix in the error message and worker logs: it names the exact admission failure.
  2. Lower sinkConfig resources (cpu, ram, disk) and parallelism/instance count within worker limits.
  3. If using Kubernetes runtime, verify service account, namespace policies, and that the function image/RBAC allow scheduling.
  4. 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

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


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