apache/pulsar · error · ParameterException

--destination-file needs to be specified

Error message

--destination-file needs to be specified

What it means

Thrown by the `functions download` subcommand when --destination-file is blank. Downloading a function artifact requires a local path to write the fetched package to, passed to functions().downloadFunction.

Source

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

        private void mergeArgs() {
            if (isBlank(destinationFile) && !isBlank(deprecatedDestinationFile)) {
                destinationFile = deprecatedDestinationFile;
            }
        }

        @Override
        void processArguments() throws Exception {
            if (path == null) {
                super.processArguments();
            }
        }

        @Override
        void runCmd() throws Exception {
            // merge deprecated args with new args
            mergeArgs();
            if (StringUtils.isBlank(destinationFile)) {
                throw new ParameterException("--destination-file needs to be specified");
            }
            if (path != null) {
                getAdmin().functions().downloadFunction(destinationFile, path);
            } else {
                getAdmin().functions()
                        .downloadFunction(destinationFile, tenant, namespace, functionName, transformFunction);
            }
            print("Downloaded successfully");
        }
    }

    @Command(description = "Reload the available built-in functions")
    public class ReloadBuiltInFunctions extends CmdFunctions.BaseCommand {

        @Override
        void runCmd() throws Exception {
            getAdmin().functions().reloadBuiltInFunctions();
        }

View on GitHub (pinned to 820761864e)

Solutions

  1. Add --destination-file <localPath> where the artifact should be saved
  2. Include --path <packagePath> (or tenant/namespace/function-name) to identify what to download
  3. Ensure the destination directory exists and is writable

Example fix

// before
pulsar-admin functions download --tenant t --namespace n --name myfunc
// after
pulsar-admin functions download --tenant t --namespace n --name myfunc --destination-file /tmp/myfunc.jar
Defensive patterns

Strategy: validation

Validate before calling

if (destinationFile == null || destinationFile.isBlank()) {
    throw new IllegalArgumentException("--destination-file is required for functions download");
}
new File(destinationFile).getParentFile().mkdirs();

Try / catch

try { admin.functions().downloadFunction(destFile, tenant, ns, fn, false); }
catch (ParameterException e) { if (e.getMessage().contains("--destination-file")) { log.error("Provide --destination-file <local path>"); } throw e; }

Prevention

When it happens

Trigger: Running `pulsar-admin functions download` without --destination-file (or empty), checked at CmdFunctions.java:1224 before calling downloadFunction with either --path or tenant/namespace/functionName.

Common situations: Fetching an artifact but omitting where to save it; assuming a default local filename is used (there is none); script variable for the destination empty; mixing up --source-file (upload) with --destination-file (download).

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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