apache/pulsar · error · ParameterException

Can not enable for all producers but denies for replicators

Error message

Can not enable for all producers but denies for replicators

What it means

Thrown by the schema auto-update command when the requested combination is logically contradictory: the main toggle is enabled (--enable, applying to all producers) but the replicator-specific flag explicitly denies auto-update for replicators. Since enabling for all producers includes replicators, denying them at the same time is rejected with this ParameterException before calling setIsAllowAutoUpdateSchema.

Source

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

        @Option(names = { "--disable", "-d" }, description = "Disable schema validation enforced")
        private boolean disable = false;

        @Option(names = { "--enable-for-replicator" },
                description = "By default, brokers always allow replicator to register new compatible schemas even"
                + " when auto updates are disabled, if you want to disable replicators to register compatible schemas,"
                + " please set it to false")
        private Boolean enableForReplicator;

        @Override
        void run() throws PulsarAdminException {
            String namespace = validateNamespace(namespaceName);

            if (enable == disable) {
                throw new ParameterException("Need to specify either --enable or --disable");
            }
            if (enable && enableForReplicator != null && !enableForReplicator) {
                throw new ParameterException("Can not enable for all producers but denies for replicators");
            }
            getAdmin().namespaces().setIsAllowAutoUpdateSchema(namespace, enable, enableForReplicator);
        }
    }

    @Command(description = "Get the schema validation enforced")
    private class GetSchemaValidationEnforced extends CliCommand {
        @Parameters(description = "tenant/namespace", arity = "1")
        private String namespaceName;

        @Option(names = { "-ap", "--applied" }, description = "Get the applied policy of the namespace")
        private boolean applied = false;

        @Override
        void run() throws PulsarAdminException {
            String namespace = validateNamespace(namespaceName);

            System.out.println(getAdmin().namespaces().getSchemaValidationEnforced(namespace, applied));

View on GitHub (pinned to 820761864e)

Solutions

  1. Use --enable without the replicator-deny flag (replicators will be included).
  2. If replicators must be excluded, disable auto-update overall and configure per-namespace instead, or use the replicator-specific enable flag only with --disable.
  3. Review scripted flag assembly so the main toggle and the replicator flag are consistent.

Example fix

// before
pulsar-admin namespaces set-schema-auto-update-strategy public/default --enable --disable-for-replicator
// after
pulsar-admin namespaces set-schema-auto-update-strategy public/default --enable
Defensive patterns

Strategy: validation

Validate before calling

if [ "$ENABLE" = "--enable" ] && [ -n "$REPLICATOR_FLAG" ] && [ "$REPLICATOR_FLAG" = "--disable-for-replicator" ]; then
  echo "cannot enable for producers while denying replicators"; exit 1
fi

Prevention

When it happens

Trigger: Running the auto-update-schema command with --enable together with a --disable-for-replicator / enableForReplicator=false option.

Common situations: Misunderstanding the scoping of the replicator flag (it can only narrow a disabled setup or explicitly opt in); copying flags from two different examples into one command; template conditionals emitting both an enable and a replicator-deny flag.

Related errors


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