apache/pulsar · error · IllegalArgumentException
Per instance CPU requested, %s, for function is greater than
Error message
Per instance CPU requested, %s, for function is greater than the maximum required, %s
What it means
validateMaxResourcesRequired enforces a worker-configured maximum CPU per function instance. If functionDetails.resources.cpu exceeds functionInstanceMaxResources.cpu, Pulsar throws IllegalArgumentException with both values to prevent oversized functions from being admitted to Kubernetes.
Source
Thrown at pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java:481
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));
}
}
}
}
void validateMaxResourcesRequired(FunctionDetails functionDetails) {
if (functionInstanceMaxResources != null) {
Double maxCpu = functionInstanceMaxResources.getCpu();
Long maxRam = functionInstanceMaxResources.getRam();
if (maxCpu != null && functionDetails.getResources().getCpu() > maxCpu) {
throw new IllegalArgumentException(
String.format(
"Per instance CPU requested, %s, for function is greater than the maximum required, %s",
functionDetails.getResources().getCpu(), maxCpu));
}
if (maxRam != null && functionDetails.getResources().getRam() > maxRam) {
throw new IllegalArgumentException(
String.format(
"Per instance RAM requested, %s, for function is greater than the maximum required, %s",
functionDetails.getResources().getRam(), maxRam));
}
}
}
void validateResourcesGranularityAndProportion(FunctionDetails functionDetails) {
final long baseMillis = 1000;
long multiples = 0L;
if (functionInstanceResourceGranularities != null) {View on GitHub (pinned to 820761864e)
Solutions
- Reduce the function's --cpu to at most the configured maximum.
- Split the workload into more function instances with lower per-instance CPU instead of raising per-instance CPU.
- Ask the cluster admin to raise functionInstanceMaxResources.cpu if the cap is too low.
- Check whether a units mistake (millicores vs cores) inflated the requested value.
Example fix
// before --cpu 8 // after --cpu 2 (assuming max cpu is 2) -- or increase --instances to scale out
Defensive patterns
Strategy: validation
Validate before calling
Double maxCpu = workerCfg.getFunctionInstanceMaxResources().getCpu();
if (maxCpu != null && details.getResources().getCpu() > maxCpu) {
throw new IllegalArgumentException("cpu " + details.getResources().getCpu() + " > allowed max " + maxCpu);
} Try / catch
try { admin.functions().updateFunction(config); } catch (IllegalArgumentException e) { if (e.getMessage().contains("greater than the maximum")) { /* lower cpu / scale out instances */ } throw e; } Prevention
- Cap CPU in deployment templates to the cluster maximum
- Prefer horizontal scale (more instances) over raising per-instance CPU
- Watch for core-vs-millicore unit mistakes
When it happens
Trigger: Submitting/updating a function whose --cpu is greater than the cluster's configured functionInstanceMaxResources.cpu (doAdmissionChecks -> validateMaxResourcesRequired, line 481).
Common situations: Scaling CPU up without checking cluster caps; copying configs from a cluster without maximums; accidental unit mistakes (cores vs millicores); cluster admin tightening max resources after deployment.
Related errors
- Per instance CPU requested, %s, for function is less than th
- Per instance CPU requested is not specified. Must specify CP
- Per instance RAM requested, %s, for function is less than th
- Per instance RAM requested, %s, for function is greater than
- Per instance RAM requested is not specified. Must specify RA
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/66a281f77f9908d7.
Report an issue: GitHub.