{"record":{"id":"e634e7d171e94b6f","repo":"apache/pulsar","slug":"can-not-enable-for-all-producers-but-denies-for-re","errorCode":null,"errorMessage":"Can not enable for all producers but denies for replicators, which is meaningless","messagePattern":"Can not enable for all producers but denies for replicators, which is meaningless","errorType":"http","errorClass":"RestException","httpStatus":400,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Namespaces.java","lineNumber":3082,"sourceCode":"    @Path(\"/{tenant}/{namespace}/isAllowAutoUpdateSchema\")\n    @Operation(summary = \"Update flag of whether to allow auto update schema\")\n    @ApiResponses(value = {\n            @ApiResponse(responseCode = \"200\", description = \"Operation successful\"),\n            @ApiResponse(responseCode = \"403\", description = \"Don't have admin permission\"),\n            @ApiResponse(responseCode = \"404\", description = \"Namespace doesn't exist\"),\n            @ApiResponse(responseCode = \"409\", description = \"Concurrent modification\")})\n    public void setIsAllowAutoUpdateSchema(\n            @PathParam(\"tenant\") String tenant,\n            @PathParam(\"namespace\") String namespace,\n            @QueryParam(\"allowAutoUpdateSchemaWithReplicator\")\n            @Parameter(description = \"Allow replicator to auto update schema\")\n                    Boolean allowAutoUpdateSchemaWithReplicator,\n            @RequestBody(description = \"Flag of whether to allow auto update schema\", required = true)\n                    boolean isAllowAutoUpdateSchema) {\n        validateNamespaceName(tenant, namespace);\n        if (isAllowAutoUpdateSchema && allowAutoUpdateSchemaWithReplicator != null\n                && !allowAutoUpdateSchemaWithReplicator) {\n            throw new RestException(Response.Status.BAD_REQUEST, \"Can not enable for all producers but denies for\"\n                    + \" replicators, which is meaningless\");\n        }\n        internalSetIsAllowAutoUpdateSchema(isAllowAutoUpdateSchema, allowAutoUpdateSchemaWithReplicator);\n    }\n\n    @GET\n    @Path(\"/{tenant}/{namespace}/subscriptionTypesEnabled\")\n    @Operation(summary = \"The set of enabled subscription types\")\n    @ApiResponses(value = {\n            @ApiResponse(responseCode = \"200\", description = \"The set of enabled subscription types\",\n                    content = @Content(array = @ArraySchema(schema = @Schema(implementation = SubscriptionType.class),\n                            uniqueItems = true))),\n            @ApiResponse(responseCode = \"403\", description = \"Don't have admin permission\"),\n            @ApiResponse(responseCode = \"404\", description = \"Namespace doesn't exist\"),\n            @ApiResponse(responseCode = \"409\", description = \"Concurrent modification\") })\n    public void getSubscriptionTypesEnabled(\n            @Suspended final AsyncResponse asyncResponse,\n            @PathParam(\"tenant\") String tenant,","sourceCodeStart":3064,"sourceCodeEnd":3100,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Namespaces.java#L3064-L3100","documentation":"Validation in the Namespaces admin endpoint that sets isAllowAutoUpdateSchema. If auto-update-schema is being enabled for all producers (true) while the optional replicator-specific flag is explicitly set to false (deny for replicators), the combination is contradictory and rejected with HTTP 400 BAD_REQUEST.","triggerScenarios":"POST /admin/v2/namespaces/{tenant}/{namespace}/schemaAutoUpdate with body isAllowAutoUpdateSchema=true and allowAutoUpdateSchemaWithReplicator=false (query/body param) — enabling schema auto-update globally while explicitly forbidding it for replicators.","commonSituations":"Scripts that always send both fields with hardcoded booleans; partial config merge where a null (unset) replicator flag was accidentally materialized as false; operators wanting 'only replicators may update schema' who invert the flags.","solutions":["Either set allowAutoUpdateSchemaWithReplicator to true, or omit it (leave null) when isAllowAutoUpdateSchema=true.","If replicators must be excluded while producers can update, that combination is unsupported — instead control replicator schema updates at the policy level or use a different namespace policy.","Fix automation/templates so the replicator flag is only sent when it has an explicit intended value."],"exampleFix":"// before\nnsAction.setSchemaAutoUpdateStrategy(true, false);\n\n// after\nnsAction.setSchemaAutoUpdateStrategy(true, true); // or (true, null) to leave replicator flag unset","handlingStrategy":"validation","validationCode":"if (allowAutoUpdate && Boolean.FALSE.equals(allowAutoUpdateWithReplicator)) {\n    throw new IllegalArgumentException(\n        \"Cannot set isAllowAutoUpdateSchema=true while allowAutoUpdateSchemaWithReplicator=false\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only send allowAutoUpdateSchemaWithReplicator when it has an explicit intended value (null otherwise).","Avoid hardcoded boolean templates that merge both flags unconditionally.","Document the invariant: enabling for all producers implies enabling for replicators."],"tags":["pulsar","admin-api","rest-exception","schema","validation"],"backgroundTag":"conflicting-parameters","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}