apache/pulsar · error · ParameterException

The specified jar file does not exist

Error message

The specified jar file does not exist

What it means

Thrown when the --jar value is a local filesystem path (not builtin:// and not a supported package URL) but no file exists at that path. The CLI validates artifact existence before submitting the function so failures surface early, before any admin request is sent.

Source

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

                org.apache.pulsar.common.functions.Utils.inferMissingNamespace(functionConfig);
            }

            if (isNotBlank(functionConfig.getJar()) && isNotBlank(functionConfig.getPy())
                    && 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 "

View on GitHub (pinned to 820761864e)

Solutions

  1. Correct the --jar path or cd to the directory containing the jar
  2. Build the jar first (e.g. mvn package) and point --jar at the produced artifact
  3. Use an absolute path or a supported package URL (file:///http(s)://) instead of a fragile relative path
  4. If the function is built-in, use --jar builtin://<function-name>

Example fix

// before
--jar target/functions.jar   (file not built)
// after
mvn package && --jar /abs/path/target/functions.jar
Defensive patterns

Strategy: validation

Validate before calling

String jar = config.getJar();
if (jar != null && !jar.startsWith("builtin://") && !Utils.isFunctionPackageUrlSupported(jar)
        && !new File(jar).exists()) {
    throw new IllegalStateException("jar does not exist: " + jar);
}

Try / catch

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

Prevention

When it happens

Trigger: `pulsar-admin functions create/update/localrun` with --jar <path> where new File(path).exists() is false and the value is neither builtin:// nor a package-URL-supported location (CmdFunctions.java:732).

Common situations: Typos in the jar path; running the CLI from a different working directory with a relative path; artifact not built yet (mvn/gradle build skipped); CI workspace where the artifact was cleaned; path pointing to a file removed after a rebuild.

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/9d682b8dcfef5427. Report an issue: GitHub.