{"record":{"id":"f38de9c4a118b4fd","repo":"apache/pulsar","slug":"per-instance-ram-requested-s-for-function-is-gr","errorCode":null,"errorMessage":"Per instance RAM requested, %s, for function is greater than the maximum required, %s","messagePattern":"Per instance RAM requested, (.+?), for function is greater than the maximum 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":488,"sourceCode":"                }\n            }\n        }\n    }\n\n    void validateMaxResourcesRequired(FunctionDetails functionDetails) {\n        if (functionInstanceMaxResources != null) {\n            Double maxCpu = functionInstanceMaxResources.getCpu();\n            Long maxRam = functionInstanceMaxResources.getRam();\n\n            if (maxCpu != null && functionDetails.getResources().getCpu() > maxCpu) {\n                throw new IllegalArgumentException(\n                        String.format(\n                                \"Per instance CPU requested, %s, for function is greater than the maximum required, %s\",\n                                functionDetails.getResources().getCpu(), maxCpu));\n            }\n\n            if (maxRam != null && functionDetails.getResources().getRam() > maxRam) {\n                throw new IllegalArgumentException(\n                        String.format(\n                                \"Per instance RAM requested, %s, for function is greater than the maximum required, %s\",\n                                functionDetails.getResources().getRam(), maxRam));\n            }\n        }\n    }\n\n    void validateResourcesGranularityAndProportion(FunctionDetails functionDetails) {\n        final long baseMillis = 1000;\n        long multiples = 0L;\n        if (functionInstanceResourceGranularities != null) {\n            Double grnCpu = functionInstanceResourceGranularities.getCpu();\n            Long grnRam = functionInstanceResourceGranularities.getRam();\n            if (grnCpu != null) {\n                // convert cpus to milli-cores to avoid loss of precision\n                long grnCpuMillis = Math.round(baseMillis * grnCpu);\n                if (grnCpuMillis > 0) {\n                    long cpuMillis = Math.round(baseMillis * functionDetails.getResources().getCpu());","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java#L470-L506","documentation":"validateMaxResourcesRequired enforces a worker-configured maximum RAM per function instance. If functionDetails.resources.ram exceeds functionInstanceMaxResources.ram, Pulsar throws IllegalArgumentException with both values.","triggerScenarios":"Submitting/updating a function whose --ram (bytes) is greater than the cluster's configured functionInstanceMaxResources.ram (doAdmissionChecks -> validateMaxResourcesRequired, line 488).","commonSituations":"Generously sizing memory 'to be safe'; unit confusion between MB/GB and bytes when passing --ram; configs copied from clusters without maximums; max lowered by admins after initial deployment.","solutions":["Reduce the function's --ram to at most the configured maximum.","Scale out with more instances at lower per-instance RAM instead of one large instance.","Ask the cluster admin to raise functionInstanceMaxResources.ram if needed.","Verify byte conversion of the --ram value (e.g. 1Gi = 1073741824)."],"exampleFix":"// before\n--ram 17179869184  (16Gi)\n// after\n--ram 8589934592  (8Gi, assuming max ram is 8Gi)","handlingStrategy":"validation","validationCode":"Long maxRam = workerCfg.getFunctionInstanceMaxResources().getRam();\nif (maxRam != null && details.getResources().getRam() > maxRam) {\n    throw new IllegalArgumentException(\"ram \" + details.getResources().getRam() + \" > allowed max \" + maxRam);\n}","typeGuard":null,"tryCatchPattern":"try { admin.functions().updateFunction(config); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"greater than the maximum\")) { /* lower ram / scale out instances */ } throw e; }","preventionTips":["Cap RAM in deployment templates to the cluster maximum","Double-check byte conversions (Gi = 1073741824) when setting --ram","Re-validate stored function configs against new max-resources settings after admin changes"],"tags":["kubernetes","resources","memory","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"}