apache/pulsar · error · IllegalArgumentException

Per instance RAM requested is not specified. Must specify RA

Error message

Per instance RAM requested is not specified. Must specify RAM requested for function to be at least %s

What it means

validateMinResourcesRequired enforces a worker-configured minimum RAM per instance. If functionInstanceMinResources.ram is set but the function has no Resources section, Pulsar throws IllegalArgumentException instructing the user to specify RAM at least equal to the minimum.

Source

Thrown at pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java:462

            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, "
                                            + "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) {

View on GitHub (pinned to 820761864e)

Solutions

  1. Add --ram <bytes> (>= configured minimum) to the function create/update command.
  2. Set resources.ram in the FunctionDetails/config yaml before submission.
  3. Ask the cluster admin to adjust functionInstanceMinResources.ram.
  4. Pre-validate in your pipeline that both cpu and ram are present when the worker enforces minimums.

Example fix

// before
pulsar-admin functions create --name f --inputs t ...
// after
pulsar-admin functions create --name f --inputs t --ram 1073741824 ...
Defensive patterns

Strategy: validation

Validate before calling

Resources res = config.getResources();
Long minRam = workerCfg.getFunctionInstanceMinResources().getRam();
if (minRam != null && (res == null || !res.isSetRam())) {
    throw new IllegalArgumentException("--ram is required and must be >= " + minRam);
}

Try / catch

try { admin.functions().createFunction(config); } catch (IllegalArgumentException e) { if (e.getMessage().contains("RAM requested is not specified")) { config.setResources(...); } throw e; }

Prevention

When it happens

Trigger: Submitting a function without --ram (functionDetails has no resources) while the worker enforces functionInstanceMinResources.ram (doAdmissionChecks -> validateMinResourcesRequired, line 462).

Common situations: Deployment automation that omits memory flags; cluster config tightened with min resources after functions were originally deployed without them; users assuming client-side defaults apply.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/a7249edd0dcc410d. Report an issue: GitHub.