{"record":{"id":"80673ff55996be27","repo":"apache/pulsar","slug":"per-instance-cpu-requested-s-for-function-is-le","errorCode":null,"errorMessage":"Per instance CPU requested, %s, for function is less than the minimum required, %s","messagePattern":"Per instance CPU requested, (.+?), for function is less than the minimum required, (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java","lineNumber":453,"sourceCode":"                        .attr(\"newValue\", data.get(field.getName()))\n                        .log(\"Kubernetes Config changed\");\n                field.set(kubernetesRuntimeFactory, data.get(field.getName()));\n            }\n        }\n    }\n\n    void validateMinResourcesRequired(FunctionDetails functionDetails) {\n        if (functionInstanceMinResources != null) {\n            Double minCpu = functionInstanceMinResources.getCpu();\n            Long minRam = functionInstanceMinResources.getRam();\n\n            if (minCpu != null) {\n                if (!functionDetails.hasResources()) {\n                    throw new IllegalArgumentException(\n                            String.format(\"Per instance CPU requested is not specified. \"\n                                    + \"Must specify CPU requested for function to be at least %s\", minCpu));\n                } else if (functionDetails.getResources().getCpu() < minCpu) {\n                    throw new IllegalArgumentException(\n                            String.format(\"Per instance CPU requested, %s, \"\n                                            + \"for function is less than the minimum required, %s\",\n                                    functionDetails.getResources().getCpu(), minCpu));\n                }\n            }\n\n            if (minRam != null) {\n                if (!functionDetails.hasResources()) {\n                    throw new IllegalArgumentException(\n                            String.format(\"Per instance RAM requested is not specified. \"\n                                    + \"Must specify RAM requested for function to be at least %s\", minRam));\n                } else if (functionDetails.getResources().getRam() < minRam) {\n                    throw new IllegalArgumentException(\n                            String.format(\"Per instance RAM requested, %s, \"\n                                            + \"for function is less than the minimum required, %s\",\n                                    functionDetails.getResources().getRam(), minRam));\n                }\n            }","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java#L435-L471","documentation":"validateMinResourcesRequired rejects functions whose requested CPU is below the worker-configured minimum. When functionDetails.resources.cpu < functionInstanceMinResources.cpu, an IllegalArgumentException reports both values.","triggerScenarios":"Submitting/updating a function with --cpu lower than the cluster's functionInstanceMinResources.cpu (admission check path doAdmissionChecks -> validateMinResourcesRequired, line 453).","commonSituations":"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.","solutions":["Increase the function's --cpu to at least the configured minimum.","Request the cluster admin to lower functionInstanceMinResources.cpu if the limit is wrong for your workload.","Update deployment templates/CI to enforce the minimum at submission time with a clear error."],"exampleFix":"// before\n--cpu 0.2\n// after\n--cpu 1.0  (assuming min cpu is 1.0)","handlingStrategy":"validation","validationCode":"if (minCpu != null && details.getResources().getCpu() < minCpu) {\n    throw new IllegalArgumentException(\"cpu \" + details.getResources().getCpu() + \" < required min \" + minCpu);\n}","typeGuard":null,"tryCatchPattern":"try { admin.functions().updateFunction(config); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"less than the minimum\")) { /* raise cpu or notify admin */ } throw e; }","preventionTips":["Fetch the worker's admission config and clamp submitted cpu values to it","Add a CI pre-check comparing requested CPU against cluster minimums","Keep per-environment resource templates in sync with worker configs"],"tags":["kubernetes","resources","cpu","quota","admission"],"backgroundTag":"resource-quota-exceeded","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}