apache/pulsar · error · IllegalArgumentException

Per instance CPU requested, %s, for function is less than th

Error message

Per instance CPU requested, %s, for function is less than the minimum required, %s

What it means

validateMinResourcesRequired rejects functions whose requested CPU is below the worker-configured minimum. When functionDetails.resources.cpu < functionInstanceMinResources.cpu, an IllegalArgumentException reports both values.

Source

Thrown at pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java:453

                        .attr("newValue", data.get(field.getName()))
                        .log("Kubernetes Config changed");
                field.set(kubernetesRuntimeFactory, data.get(field.getName()));
            }
        }
    }

    void validateMinResourcesRequired(FunctionDetails functionDetails) {
        if (functionInstanceMinResources != null) {
            Double minCpu = functionInstanceMinResources.getCpu();
            Long minRam = functionInstanceMinResources.getRam();

            if (minCpu != null) {
                if (!functionDetails.hasResources()) {
                    throw new IllegalArgumentException(
                            String.format("Per instance CPU requested is not specified. "
                                    + "Must specify CPU requested for function to be at least %s", minCpu));
                } else if (functionDetails.getResources().getCpu() < minCpu) {
                    throw new IllegalArgumentException(
                            String.format("Per instance CPU requested, %s, "
                                            + "for function is less than the minimum required, %s",
                                    functionDetails.getResources().getCpu(), minCpu));
                }
            }

            if (minRam != null) {
                if (!functionDetails.hasResources()) {
                    throw new IllegalArgumentException(
                            String.format("Per instance RAM requested is not specified. "
                                    + "Must specify RAM requested for function to be at least %s", minRam));
                } else if (functionDetails.getResources().getRam() < minRam) {
                    throw new IllegalArgumentException(
                            String.format("Per instance RAM requested, %s, "
                                            + "for function is less than the minimum required, %s",
                                    functionDetails.getResources().getRam(), minRam));
                }
            }

View on GitHub (pinned to 820761864e)

Solutions

  1. Increase the function's --cpu to at least the configured minimum.
  2. Request the cluster admin to lower functionInstanceMinResources.cpu if the limit is wrong for your workload.
  3. Update deployment templates/CI to enforce the minimum at submission time with a clear error.

Example fix

// before
--cpu 0.2
// after
--cpu 1.0  (assuming min cpu is 1.0)
Defensive patterns

Strategy: validation

Validate before calling

if (minCpu != null && details.getResources().getCpu() < minCpu) {
    throw new IllegalArgumentException("cpu " + details.getResources().getCpu() + " < required min " + minCpu);
}

Try / catch

try { admin.functions().updateFunction(config); } catch (IllegalArgumentException e) { if (e.getMessage().contains("less than the minimum")) { /* raise cpu or notify admin */ } throw e; }

Prevention

When it happens

Trigger: Submitting/updating a function with --cpu lower than the cluster's functionInstanceMinResources.cpu (admission check path doAdmissionChecks -> validateMinResourcesRequired, line 453).

Common situations: Copy-pasting function configs from a cluster with laxer limits; reducing CPU to cut cost after a policy tightening; environment migration (dev -> prod) where prod enforces minimums.

Related errors


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