apache/pulsar · error · ParameterException

Required at least one property for the namespace, but found

Error message

Required at least one property for the namespace, but found %d.

What it means

When setting the properties map of a namespace via `pulsar-admin namespaces set-properties`, the CLI requires at least one key=value entry. An empty list would wipe the properties map, which the CLI guards against by throwing a ParameterException.

Source

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

            getAdmin().namespaces().setProperty(namespace, key, value);
        }
    }

    @Command(description = "Set properties of a namespace")
    private class SetPropertiesForNamespace extends CliCommand {

        @Parameters(description = "tenant/namespace", arity = "1")
        private String namespaceName;

        @Option(names = {"--properties", "-p"}, description = "key value pair properties(a=a,b=b,c=c)",
                required = true)
        private java.util.List<String> properties;

        @Override
        void run() throws Exception {
            String namespace = validateNamespace(namespaceName);
            if (properties.size() == 0) {
                throw new ParameterException(String.format("Required at least one property for the namespace, "
                        + "but found %d.", properties.size()));
            }
            Map<String, String> map = parseListKeyValueMap(properties);
            getAdmin().namespaces().setProperties(namespace, map);
        }
    }

    @Command(description = "Get property for a namespace")
    private class GetPropertyForNamespace extends CliCommand {

        @Parameters(description = "tenant/namespace", arity = "1")
        private String namespaceName;

        @Option(names = {"--key", "-k"}, description = "Key of the property", required = true)
        private String key;

        @Override
        void run() throws Exception {

View on GitHub (pinned to 820761864e)

Solutions

  1. Provide at least one key=value pair, e.g. --properties env=prod team=data
  2. If the goal is to clear all properties, use the dedicated delete/unset path (remove properties individually) rather than passing an empty list
  3. Fix shell quoting so the key=value list actually reaches the CLI

Example fix

// before
pulsar-admin namespaces set-properties my-tenant/my-ns --properties ""
// after
pulsar-admin namespaces set-properties my-tenant/my-ns --properties env=prod --properties team=data
Defensive patterns

Strategy: validation

Validate before calling

if (properties == null || properties.isEmpty()) {
    throw new IllegalArgumentException("At least one key=value property is required");
}

Try / catch

try {
    admin.namespaces().setProperties(namespace, map);
} catch (org.apache.pulsar.client.admin.PulsarAdminException e) {
    // handle invalid/empty properties
}

Prevention

When it happens

Trigger: Running `pulsar-admin namespaces set-properties <namespace>` with no --properties values, or with an empty string value so the parsed list has size 0.

Common situations: Shell variable holding properties is empty/unset; quoting issue causes the argument to vanish; scripting that loops over properties that happen to be empty.

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/1796f7801e8fa31a. Report an issue: GitHub.