apache/skywalking · error · IllegalArgumentException
Uncreated metrics {}
Error message
Uncreated metrics {} What it means
buildMetrics(name, dataType) hands a caller a fresh AcceptableValue instance from the prototype registered under that metric name. If meterPrototypes has no entry for the name — the metric was never created via MeterSystem.create, was removed, or the name is spelled differently — it throws 'Uncreated metrics <name>'.
Source
Thrown at oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/MeterSystem.java:727
throw new UnexpectedException(e.getMessage(), e);
}
}
/**
* Create an {@link AcceptableValue} instance for streaming calculation. AcceptableValue instance is stateful,
* shouldn't do {@link AcceptableValue#accept(MeterEntity, Object)} once it is pushed into {@link
* #doStreamingCalculation(AcceptableValue)}.
*
* @param metricsName A defined metrics name. Use {@link #create(String, String, ScopeType, Class)} to define a new
* one.
* @param dataType class type of the input of {@link AcceptableValue}
* @return usable an {@link AcceptableValue} instance.
*/
public <T> AcceptableValue<T> buildMetrics(String metricsName,
Class<T> dataType) {
MeterDefinition meterDefinition = meterPrototypes.get(metricsName);
if (meterDefinition == null) {
throw new IllegalArgumentException("Uncreated metrics " + metricsName);
}
if (!meterDefinition.getDataType().equals(dataType)) {
throw new IllegalArgumentException(
"Unmatched metrics data type, request for " + dataType.getName()
+ ", but defined as " + meterDefinition.getDataType());
}
return meterDefinition.getMeterPrototype().createNew();
}
/**
* Active the {@link MetricsStreamProcessor#in(Metrics)} for streaming calculation.
*
* @param acceptableValue should only be created through {@link #create(String, String, ScopeType, Class)}
*/
public void doStreamingCalculation(AcceptableValue acceptableValue) {
final long timeBucket = acceptableValue.getTimeBucket();
if (timeBucket == 0L) {View on GitHub (pinned to 102af09b4a)
Solutions
- Ensure create(metricsName, functionName, scopeType, dataType) ran successfully for exactly that name before any buildMetrics call — check OAP startup logs for rule apply errors
- Align the name strings (case-sensitive) between the create site and the buildMetrics site
- If the metric was hot-removed, stop the emitting pipeline or re-apply the rule that defines it
Example fix
// before
AcceptableValue<Long> v = meterSystem.buildMetrics("service_cpm", Long.class);
// rule defines "service_cpm_sum" -> Uncreated metrics service_cpm
// after
AcceptableValue<Long> v = meterSystem.buildMetrics("service_cpm_sum", Long.class); Defensive patterns
Strategy: validation
Validate before calling
// MeterSystem has no public lookup; track the names you created
Set<String> created = ConcurrentHashMap.newKeySet();
created.add(name); // after successful meterSystem.create(name, ...)
if (!created.contains(name)) throw new IllegalStateException("Metric not created: " + name);
AcceptableValue<Long> v = meterSystem.buildMetrics(name, Long.class); Try / catch
try {
AcceptableValue<Long> v = meterSystem.buildMetrics(name, Long.class);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Uncreated metrics")) {
log.warn("Metric {} not registered yet (rule not applied or removed); dropping sample", name);
return; // drop or buffer instead of crashing the receiver
}
throw e;
} Prevention
- Register all metrics during module prepare()/start() before data can arrive
- Use a single constant for each metric name shared by create() and buildMetrics() call sites
- Treat rule-apply failures at startup as fatal — later buildMetrics calls will fail confusingly otherwise
When it happens
Trigger: MAL/LAL or custom analyzer code calls buildMetrics for a metric whose create() never ran on this node (e.g. the rule defining it failed earlier or was hot-removed); a typo or case difference between the create() name and the buildMetrics name; calling buildMetrics during startup before the meter rules were applied.
Common situations: Custom receiver plugins that reference a metric defined in a MAL file that failed to load; race at OAP boot between data arrival and rule application; renaming a metric in config but not in the code that reads it; a removed rule while buffered data still references the metric.
Related errors
- {} has been defined, but calculate function or/are scope typ
- Unmatched metrics data type, request for {}, but defined as
- MeterSystem unavailable for MAL compile of {sourceName}
- Function {} doesn't inherit from Metrics.
- buckets and values can't be null.
AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14).
Data as JSON: /api/errors/e29ca19544eb68cf.
Report an issue: GitHub.