{"record":{"id":"cfc7293d078654a8","repo":"alibaba/Sentinel","slug":"namespace-set-cannot-be-null","errorCode":null,"errorMessage":"namespace set cannot be null","messagePattern":"namespace set cannot be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterConfigService.java","lineNumber":85,"sourceCode":"    private boolean notClientRequestValid(/*@NonNull */ ClusterClientModifyRequest request) {\n        ClusterClientConfig config = request.getClientConfig();\n        return config == null || StringUtil.isEmpty(config.getServerHost())\n            || config.getServerPort() == null || config.getServerPort() <= 0\n            || config.getRequestTimeout() == null || config.getRequestTimeout() <= 0;\n    }\n\n    public CompletableFuture<Void> modifyClusterServerConfig(ClusterServerModifyRequest request) {\n        ServerTransportConfig transportConfig = request.getTransportConfig();\n        ServerFlowConfig flowConfig = request.getFlowConfig();\n        Set<String> namespaceSet = request.getNamespaceSet();\n        if (invalidTransportConfig(transportConfig)) {\n            throw new IllegalArgumentException(\"Invalid transport config in request\");\n        }\n        if (invalidFlowConfig(flowConfig)) {\n            throw new IllegalArgumentException(\"Invalid flow config in request\");\n        }\n        if (namespaceSet == null) {\n            throw new IllegalArgumentException(\"namespace set cannot be null\");\n        }\n        String app = request.getApp();\n        String ip = request.getIp();\n        int port = request.getPort();\n        return sentinelApiClient.modifyClusterServerNamespaceSet(app, ip, port, namespaceSet)\n            .thenCompose(v -> sentinelApiClient.modifyClusterServerTransportConfig(app, ip, port, transportConfig))\n            .thenCompose(v -> sentinelApiClient.modifyClusterServerFlowConfig(app, ip, port, flowConfig))\n            .thenCompose(v -> sentinelApiClient.modifyClusterMode(ip, port, ClusterStateManager.CLUSTER_SERVER));\n    }\n\n    /**\n     * Get cluster state list of all available machines of provided application.\n     *\n     * @param app application name\n     * @return cluster state list of all available machines of the application\n     * @since 1.4.1\n     */\n    public CompletableFuture<List<ClusterUniversalStatePairVO>> getClusterUniversalState(String app) {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/alibaba/Sentinel/blob/a3f40ba8e900c8489bd520274739f17235a7721c/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterConfigService.java#L67-L103","documentation":"Third validation in ClusterConfigService.modifyClusterServerConfig: the namespaceSet (the set of app namespaces this token server serves) must be provided. A null namespaceSet throws IllegalArgumentException before the four chained modify calls to the target machine are issued.","triggerScenarios":"ClusterServerModifyRequest where namespaceSet was never set (null), e.g. JSON body lacking the namespaceSet array.","commonSituations":"Custom dashboards or automation scripts posting partial cluster-server payloads; frontend bugs that skip the namespace selection step.","solutions":["Set namespaceSet explicitly, usually to the set of application names the server serves, e.g. Collections.singleton(appName).","Include a namespaceSet array in the JSON payload (empty set is accepted, null is not).","Verify your custom client code calls setNamespaceSet after upgrading the dashboard, which made this field mandatory."],"exampleFix":"// before\nreq.setFlowConfig(new ServerFlowConfig());\n// namespaceSet not set\nclusterConfigService.modifyClusterServerConfig(req);\n\n// after\nreq.setNamespaceSet(Collections.singleton(appName));\nclusterConfigService.modifyClusterServerConfig(req);","handlingStrategy":"validation","validationCode":"if (request.getNamespaceSet() == null) {\n    request.setNamespaceSet(Collections.singleton(appName));\n}\nclusterConfigService.modifyClusterServerConfig(request);","typeGuard":"boolean hasNamespaceSet(ClusterServerModifyRequest r) {\n    return r.getNamespaceSet() != null;\n}","tryCatchPattern":null,"preventionTips":["Serialize namespaceSet as an explicit (possibly empty) array in JSON payloads — never omit it.","Bind the namespace selector to the current app list so it is always populated."],"tags":["sentinel","cluster","dashboard","namespace","validation"],"backgroundTag":null,"analyzedSha":"a3f40ba8e900c8489bd520274739f17235a7721c","analyzedAt":"2026-08-14T11:10:30.678Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}