{"record":{"id":"addfa6685000ba15","repo":"alibaba/Sentinel","slug":"invalid-transport-config-in-request","errorCode":null,"errorMessage":"Invalid transport config in request","messagePattern":"Invalid transport 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":79,"sourceCode":"        String ip = request.getIp();\n        int port = request.getPort();\n        return sentinelApiClient.modifyClusterClientConfig(app, ip, port, request.getClientConfig())\n            .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.","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/alibaba/Sentinel/blob/a3f40ba8e900c8489bd520274739f17235a7721c/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterConfigService.java#L61-L97","documentation":"ClusterConfigService.modifyClusterServerConfig (Sentinel dashboard) first validates the ServerTransportConfig embedded in the request. invalidTransportConfig (port null or <= 0) causes IllegalArgumentException('Invalid transport config in request') before the flow-config and namespace checks run.","triggerScenarios":"POST of a ClusterServerModifyRequest whose transportConfig is null or has a non-positive port, when assigning a machine the token-server role from the dashboard.","commonSituations":"Server form submitted with an empty port; REST payload missing the transportConfig object; scripts posting partial JSON where only flowConfig was populated.","solutions":["Set transportConfig.port to the token server port (typically 18730, must be > 0) in the request.","Confirm the whole payload includes transportConfig, flowConfig, and namespaceSet — the other two are validated right after and will throw their own errors otherwise.","Check the dashboard frontend payload in browser devtools if the form seems filled but the error persists."],"exampleFix":"// before\nClusterServerModifyRequest req = new ClusterServerModifyRequest();\n// transportConfig omitted\nclusterConfigService.modifyClusterServerConfig(req);\n\n// after\nreq.setTransportConfig(new ServerTransportConfig(18730));\nreq.setFlowConfig(new ServerFlowConfig());\nreq.setNamespaceSet(Collections.singleton(app));\nclusterConfigService.modifyClusterServerConfig(req);","handlingStrategy":"validation","validationCode":"ServerTransportConfig t = request.getTransportConfig();\nif (t == null || t.getPort() == null || t.getPort() <= 0) {\n    return badRequest(\"transportConfig.port must be a positive integer\");\n}\nclusterConfigService.modifyClusterServerConfig(request);","typeGuard":"boolean isTransportConfigValid(ServerTransportConfig t) {\n    return t != null && t.getPort() != null && t.getPort() > 0;\n}","tryCatchPattern":null,"preventionTips":["Default the token server port in the UI (18730) so an empty field can never reach the service.","Validate the full triple (transportConfig, flowConfig, namespaceSet) client-side before POST."],"tags":["sentinel","cluster","dashboard","transport-config","validation"],"backgroundTag":null,"analyzedSha":"a3f40ba8e900c8489bd520274739f17235a7721c","analyzedAt":"2026-08-14T11:10:30.678Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}