apache/pulsar · error · IllegalArgumentException
Per instance CPU requested is not specified. Must specify CP
Error message
Per instance CPU requested is not specified. Must specify CPU requested for function to be at least %s
What it means
validateMinResourcesRequired enforces a worker-configured minimum CPU per function instance. If functionInstanceMinResources.cpu is set but the submitted function has no Resources section at all, Pulsar throws IllegalArgumentException telling the user to specify CPU at least equal to the configured minimum.
Source
Thrown at pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java:449
if (data.containsKey(field.getName()) && !data.get(field.getName())
.equals(field.get(kubernetesRuntimeFactory))) {
log.info().attr("field", field.getName())
.attr("oldValue", field.get(kubernetesRuntimeFactory))
.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, "View on GitHub (pinned to 820761864e)
Solutions
- Add --cpu <value> (>= configured minimum) to the function create/update command.
- Set resources.cpu in the FunctionDetails config (or functionConfig yaml) before submission.
- Ask the cluster admin to lower functionInstanceMinResources.cpu if the minimum is too strict.
- Pre-validate resources in your deployment pipeline against the worker config before calling the admin API.
Example fix
// before pulsar-admin functions create --name f --inputs t ... // after pulsar-admin functions create --name f --inputs t --cpu 0.5 ...
Defensive patterns
Strategy: validation
Validate before calling
Resources res = config.getResources();
Double minCpu = workerCfg.getFunctionInstanceMinResources().getCpu();
if (minCpu != null && (res == null || !res.isSetCpu())) {
throw new IllegalArgumentException("--cpu is required and must be >= " + minCpu);
} Try / catch
try { admin.functions().createFunction(config); } catch (IllegalArgumentException e) { if (e.getMessage().contains("CPU requested is not specified")) { config.setResources(...); } throw e; } Prevention
- Always pass --cpu when creating functions on Kubernetes runtime
- Mirror the worker's min-resources config in your deployment tooling defaults
- Review functions_worker.yml min resources after cluster upgrades
When it happens
Trigger: Submitting a function without --cpu (no functionDetails.resources) while the worker has functionInstanceMinResources.cpu configured (doAdmissionChecks -> validateMinResourcesRequired, line 449).
Common situations: New cluster hardening that introduced minimum resource settings while existing function-submit pipelines omit resources; migrating functions from a cluster without minimums; defaults stripped by automation tooling.
Related errors
- Per instance CPU requested, %s, for function is less than th
- Per instance RAM requested is not specified. Must specify RA
- Per instance CPU requested, %s, for function is greater than
- Per instance RAM requested, %s, for function is less than th
- Per instance RAM requested, %s, for function is greater than
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/1c56c7dc4b6abed0.
Report an issue: GitHub.