{"record":{"id":"f9495ff3b072343c","repo":"alibaba/Sentinel","slug":"invalid-flow-config-in-request","errorCode":null,"errorMessage":"Invalid flow config in request","messagePattern":"Invalid flow config in request","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterConfigService.java","lineNumber":82,"sourceCode":"            .thenCompose(v -> sentinelApiClient.modifyClusterMode(ip, port, ClusterStateManager.CLUSTER_CLIENT));\n    }\n\n    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","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/alibaba/Sentinel/blob/a3f40ba8e900c8489bd520274739f17235a7721c/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterConfigService.java#L64-L100","documentation":"Second validation inside ClusterConfigService.modifyClusterServerConfig: the ServerFlowConfig in a ClusterServerModifyRequest must be non-null (invalidFlowConfig checks nullability of the config object itself). A null flowConfig triggers IllegalArgumentException('Invalid flow config in request') after the transport check passes.","triggerScenarios":"ClusterServerModifyRequest with valid transportConfig but flowConfig == null (invalidFlowConfig treats null as invalid), e.g. payload built without setFlowConfig.","commonSituations":"API clients that only care about the transport settings and omit flowConfig; version drift where an older dashboard accepted requests without flowConfig but the current service requires it.","solutions":["Include a flowConfig in the request — even default values (new ServerFlowConfig()) satisfy the null check.","If posting JSON, add the flowConfig object (examTypeQps etc. optional) to the body.","Verify field name casing ('flowConfig') matches the entity when serialized."],"exampleFix":"// before\nreq.setTransportConfig(new ServerTransportConfig(18730));\n// no setFlowConfig\nclusterConfigService.modifyClusterServerConfig(req);\n\n// after\nreq.setTransportConfig(new ServerTransportConfig(18730));\nreq.setFlowConfig(new ServerFlowConfig());\nclusterConfigService.modifyClusterServerConfig(req);","handlingStrategy":"validation","validationCode":"if (request.getFlowConfig() == null) {\n    request.setFlowConfig(new ServerFlowConfig()); // defaults satisfy the check\n}\nclusterConfigService.modifyClusterServerConfig(request);","typeGuard":"boolean hasFlowConfig(ClusterServerModifyRequest r) {\n    return r.getFlowConfig() != null;\n}","tryCatchPattern":null,"preventionTips":["Always construct ClusterServerModifyRequest through a builder that sets all three config blocks.","Keep dashboard and client model versions in sync — older payloads may lack flowConfig."],"tags":["sentinel","cluster","dashboard","flow-config","validation"],"backgroundTag":null,"analyzedSha":"a3f40ba8e900c8489bd520274739f17235a7721c","analyzedAt":"2026-08-14T11:10:30.678Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}