alibaba/Sentinel · warning · IllegalArgumentException
Parameter key cannot be empty
Error message
Parameter key cannot be empty
What it means
SimpleHttpRequest models an outgoing HTTP request for the simple-http transport (used for heartbeats to the dashboard). addParam rejects blank parameter keys (null/empty/whitespace per StringUtil.isBlank) with IllegalArgumentException, because parameters are collected into a Map and serialized into the query string — a blank key would produce a malformed URL.
Source
Thrown at sentinel-transport/sentinel-transport-simple-http/src/main/java/com/alibaba/csp/sentinel/transport/heartbeat/client/SimpleHttpRequest.java:92
}
public SimpleHttpRequest setParams(Map<String, String> params) {
this.params = params;
return this;
}
public Charset getCharset() {
return charset;
}
public SimpleHttpRequest setCharset(Charset charset) {
this.charset = charset;
return this;
}
public SimpleHttpRequest addParam(String key, String value) {
if (StringUtil.isBlank(key)) {
throw new IllegalArgumentException("Parameter key cannot be empty");
}
if (params == null) {
params = new HashMap<String, String>();
}
params.put(key, value);
return this;
}
}
View on GitHub (pinned to a3f40ba8e9)
Solutions
- Filter keys before adding: skip entries where StringUtil.isBlank(key)
- Fix the source map/config that produced an empty key (often stray delimiters in property lists)
- Use fixed, literal parameter names when building SimpleHttpRequest manually
Example fix
// before
for (Map.Entry<String,String> e : params.entrySet()) {
request.addParam(e.getKey(), e.getValue());
}
// after
for (Map.Entry<String,String> e : params.entrySet()) {
if (StringUtil.isNotBlank(e.getKey())) {
request.addParam(e.getKey(), e.getValue());
}
} Defensive patterns
Strategy: validation
Validate before calling
for (Map.Entry<String,String> e : params.entrySet()) {
if (StringUtil.isNotBlank(e.getKey())) {
request.addParam(e.getKey(), e.getValue());
}
} Prevention
- Filter dynamic key maps for blank entries before building requests
- Prefer literal parameter names in custom heartbeat builders
When it happens
Trigger: request.addParam("", value) or addParam(null, value); typically when building heartbeat request parameters from a map whose keys come from dynamic config and one key is absent/empty.
Common situations: Custom heartbeat message builders; configuration maps with empty-string keys from property parsing (e.g. trailing comma in a list); tests iterating over maps without filtering.
Related errors
- Parameter key cannot be empty
- Metadata key cannot be empty
- maxSize must > 0
- Bad byte array
- Only form-encoded post request is supported
AI-assisted analysis of alibaba/Sentinel@a3f40ba8e9 (2026-08-14).
Data as JSON: /api/errors/a544a35f7d7dc145.
Report an issue: GitHub.