apache/pulsar · error · ParameterException

The specified python file does not exist

Error message

The specified python file does not exist

What it means

Function package validation in CmdFunctions: the --py option names a Python file whose path does not exist on the local filesystem (the existence check on functionConfig.getPy() fails), so the function package cannot be uploaded; the py-file path is the faulty input.

Source

Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:736

                    && isNotBlank(functionConfig.getGo())) {
                throw new ParameterException("Either a Java jar or a Python file or a Go executable binary needs to"
                        + " be specified for the function. Cannot specify both.");
            }

            if (isBlank(functionConfig.getJar()) && isBlank(functionConfig.getPy())
                    && isBlank(functionConfig.getGo())) {
                throw new ParameterException("Either a Java jar or a Python file or a Go executable binary needs to"
                        + " be specified for the function. Please specify one.");
            }

            if (!isBlank(functionConfig.getJar()) && !functionConfig.getJar().startsWith("builtin://")
                    && !Utils.isFunctionPackageUrlSupported(functionConfig.getJar())
                    && !new File(functionConfig.getJar()).exists()) {
                throw new ParameterException("The specified jar file does not exist");
            }
            if (!isBlank(functionConfig.getPy()) && !Utils.isFunctionPackageUrlSupported(functionConfig.getPy())
                    && !new File(functionConfig.getPy()).exists()) {
                throw new ParameterException("The specified python file does not exist");
            }
            if (!isBlank(functionConfig.getGo()) && !Utils.isFunctionPackageUrlSupported(functionConfig.getGo())
                    && !new File(functionConfig.getGo()).exists()) {
                throw new ParameterException("The specified go executable binary does not exist");
            }
        }
    }

    @Command(description = "Run a Pulsar Function locally, rather than deploy to a Pulsar cluster)")
    class LocalRunner extends FunctionDetailsCommand {

        // TODO: this should become BookKeeper URL and it should be fetched from Pulsar client.
        // for backwards compatibility purposes
        @Option(names = "--stateStorageServiceUrl", description = "The URL for the state storage service "
                + "(the default is Apache BookKeeper)", hidden = true)
        protected String deprecatedStateStorageServiceUrl;
        @Option(names = "--state-storage-service-url", description = "The URL for the state storage service "
                + "(the default is Apache BookKeeper) #Java, Python")

View on GitHub (pinned to 820761864e)

Solutions

  1. Verify the --py file path and that it is readable
  2. Use an absolute path if the relative one is resolved from a different working directory

Example fix

// before
--py ./fucn.py
// after
--py /abs/path/func.py
Defensive patterns

Strategy: validation

Validate before calling

String py = config.getPy();
if (py != null && !Utils.isFunctionPackageUrlSupported(py) && !new File(py).exists()) {
    throw new IllegalStateException("python file does not exist: " + py);
}

Try / catch

try { admin.functions().createFunction(...); }
catch (ParameterException e) { if (e.getMessage().equals("The specified python file does not exist")) { log.error("Check --py path: {}", config.getPy()); } throw e; }

Prevention

When it happens

Trigger: `pulsar-admin functions create/update/localrun` with --py <path> where the path is not a supported package URL and new File(path).exists() is false (CmdFunctions.java:736).

Common situations: Misspelled python file name; relative path used from the wrong working directory; .py file deleted or never uploaded to the machine running the CLI; case-sensitive filesystem mismatch (Func.py vs func.py) on Linux.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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