alibaba/Sentinel · error · IllegalStateException
strArray() is unavailable if minMax() has been called
Error message
strArray() is unavailable if minMax() has been called
What it means
StatEntryFuncMinMax throws IllegalStateException from strArray(String... values). Its state is two numeric ValueRef pairs (value + reference string for max and min); there is no storage for arbitrary string arrays, which belong to the string-array strategy.
Source
Thrown at sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/StatEntryFunc.java:193
}
@Override
public void minMax(long candidate, String ref) {
ValueRef lmax = max.get();
if (lmax.value <= candidate) {
final ValueRef cmax = new ValueRef(candidate, ref);
while (!max.compareAndSet(lmax, cmax) && (lmax = max.get()).value <= candidate) { ; }
}
ValueRef lmin = min.get();
if (lmin.value >= candidate) {
final ValueRef cmin = new ValueRef(candidate, ref);
while (!min.compareAndSet(lmin, cmin) && (lmin = min.get()).value >= candidate) { ; }
}
}
@Override
public void strArray(String... values) {
throw new IllegalStateException("strArray() is unavailable if minMax() has been called");
}
private static final class ValueRef {
final long value;
final String ref;
ValueRef(long value, String ref) {
this.value = value;
this.ref = ref;
}
}
}
View on GitHub (pinned to a3f40ba8e9)
Solutions
- Create a separate string-array entry for label data.
- Keep min/max entries numeric: call minMax(value, ref) where ref already carries one reference string per extreme.
- When defining metrics, decide up front which of count/sum, array, min/max, or string shape each entry needs.
Example fix
// before
func.strArray("p99", "host-1"); // minMax func -> throws
// after
func.minMax(elapsedMs, "host-1"); // ref string carries the tag Defensive patterns
Strategy: type-guard
Validate before calling
if (func.getStatType() == 4) { func.minMax(value, tag); } else { func.strArray(labels); } Type guard
boolean isMinMax(StatEntryFunc f) { return f.getStatType() == 4; } Prevention
- Reserve the minMax ref parameter for tagging extremes instead of strArray.
- Create string entries explicitly when label data is needed.
- Review metric schemas before adding new write call sites.
When it happens
Trigger: Calling strArray(labels) on a min/max entry — e.g. attaching descriptive tags to a latency metric entry that only records numeric extremes.
Common situations: Adding label dimensions to an existing min/max metric by reusing its entry. Overloaded logging utilities forwarding string payloads to numeric entries. Schema drift between metric definition and emitters.
Related errors
- minMax() is unavailable if countAndSum() has been called
- strArray() is unavailable if countAndSum() has been called
- count() is unavailable if minMax() has been called
- countAndSum() is unavailable if minMax() has been called
- arrayAdd() is unavailable if minMax() has been called
AI-assisted analysis of alibaba/Sentinel@a3f40ba8e9 (2026-08-14).
Data as JSON: /api/errors/f8b050d90687234f.
Report an issue: GitHub.