alibaba/Sentinel · error · IllegalArgumentException

Invalid flow config in request

Error message

Invalid flow config in request

What it means

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.

Source

Thrown at sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterConfigService.java:82

            .thenCompose(v -> sentinelApiClient.modifyClusterMode(ip, port, ClusterStateManager.CLUSTER_CLIENT));
    }

    private boolean notClientRequestValid(/*@NonNull */ ClusterClientModifyRequest request) {
        ClusterClientConfig config = request.getClientConfig();
        return config == null || StringUtil.isEmpty(config.getServerHost())
            || config.getServerPort() == null || config.getServerPort() <= 0
            || config.getRequestTimeout() == null || config.getRequestTimeout() <= 0;
    }

    public CompletableFuture<Void> modifyClusterServerConfig(ClusterServerModifyRequest request) {
        ServerTransportConfig transportConfig = request.getTransportConfig();
        ServerFlowConfig flowConfig = request.getFlowConfig();
        Set<String> namespaceSet = request.getNamespaceSet();
        if (invalidTransportConfig(transportConfig)) {
            throw new IllegalArgumentException("Invalid transport config in request");
        }
        if (invalidFlowConfig(flowConfig)) {
            throw new IllegalArgumentException("Invalid flow config in request");
        }
        if (namespaceSet == null) {
            throw new IllegalArgumentException("namespace set cannot be null");
        }
        String app = request.getApp();
        String ip = request.getIp();
        int port = request.getPort();
        return sentinelApiClient.modifyClusterServerNamespaceSet(app, ip, port, namespaceSet)
            .thenCompose(v -> sentinelApiClient.modifyClusterServerTransportConfig(app, ip, port, transportConfig))
            .thenCompose(v -> sentinelApiClient.modifyClusterServerFlowConfig(app, ip, port, flowConfig))
            .thenCompose(v -> sentinelApiClient.modifyClusterMode(ip, port, ClusterStateManager.CLUSTER_SERVER));
    }

    /**
     * Get cluster state list of all available machines of provided application.
     *
     * @param app application name
     * @return cluster state list of all available machines of the application

View on GitHub (pinned to a3f40ba8e9)

Solutions

  1. Include a flowConfig in the request — even default values (new ServerFlowConfig()) satisfy the null check.
  2. If posting JSON, add the flowConfig object (examTypeQps etc. optional) to the body.
  3. Verify field name casing ('flowConfig') matches the entity when serialized.

Example fix

// before
req.setTransportConfig(new ServerTransportConfig(18730));
// no setFlowConfig
clusterConfigService.modifyClusterServerConfig(req);

// after
req.setTransportConfig(new ServerTransportConfig(18730));
req.setFlowConfig(new ServerFlowConfig());
clusterConfigService.modifyClusterServerConfig(req);
Defensive patterns

Strategy: validation

Validate before calling

if (request.getFlowConfig() == null) {
    request.setFlowConfig(new ServerFlowConfig()); // defaults satisfy the check
}
clusterConfigService.modifyClusterServerConfig(request);

Type guard

boolean hasFlowConfig(ClusterServerModifyRequest r) {
    return r.getFlowConfig() != null;
}

Prevention

When it happens

Trigger: ClusterServerModifyRequest with valid transportConfig but flowConfig == null (invalidFlowConfig treats null as invalid), e.g. payload built without setFlowConfig.

Common situations: 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.

Related errors


AI-assisted analysis of alibaba/Sentinel@a3f40ba8e9 (2026-08-14). Data as JSON: /api/errors/f9495ff3b072343c. Report an issue: GitHub.