{"record":{"id":"1c56c7dc4b6abed0","repo":"apache/pulsar","slug":"per-instance-cpu-requested-is-not-specified-must","errorCode":null,"errorMessage":"Per instance CPU requested is not specified. Must specify CPU requested for function to be at least %s","messagePattern":"Per instance CPU requested is not specified\\. Must specify CPU requested for function to be at least (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java","lineNumber":449,"sourceCode":"            if (data.containsKey(field.getName()) && !data.get(field.getName())\n                    .equals(field.get(kubernetesRuntimeFactory))) {\n                log.info().attr(\"field\", field.getName())\n                        .attr(\"oldValue\", field.get(kubernetesRuntimeFactory))\n                        .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, \"","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java#L431-L467","documentation":"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.","triggerScenarios":"Submitting a function without --cpu (no functionDetails.resources) while the worker has functionInstanceMinResources.cpu configured (doAdmissionChecks -> validateMinResourcesRequired, line 449).","commonSituations":"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.","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."],"exampleFix":"// before\npulsar-admin functions create --name f --inputs t ...\n// after\npulsar-admin functions create --name f --inputs t --cpu 0.5 ...","handlingStrategy":"validation","validationCode":"Resources res = config.getResources();\nDouble minCpu = workerCfg.getFunctionInstanceMinResources().getCpu();\nif (minCpu != null && (res == null || !res.isSetCpu())) {\n    throw new IllegalArgumentException(\"--cpu is required and must be >= \" + minCpu);\n}","typeGuard":null,"tryCatchPattern":"try { admin.functions().createFunction(config); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"CPU requested is not specified\")) { config.setResources(...); } throw e; }","preventionTips":["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"],"tags":["kubernetes","resources","cpu","validation","admission"],"backgroundTag":"missing-resource-configuration","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"}