apache/seatunnel · warning

Metric array size mismatch for table

Error message

Metric array size mismatch for table '{}': expected {} vertices {} but got {} metric entries. Using table name only to avoid incorrect attribution.

What it means

When the metric array size for a table exceeds the number of configured vertices (arraySize > vertexIdentifiers.size()), or in the mismatch fallback branch, processMetric() cannot map entries to vertices positionally, so it logs this warning and aggregates all entries under the plain table-name key to avoid attributing metrics to the wrong vertex.

Solutions

  1. Check raw metrics to identify the extra array entries and where they come from (stale vertices or duplicates).
  2. Ensure the job config and the metrics store are consistent — restart metric collection for the job after parallelism changes.
  3. Run matching SeaTunnel versions across the cluster so array layouts match the parser's expectations.
  4. Accept table-name-level aggregation if per-vertex detail is not required; the fallback preserves the data.
Defensive patterns

Strategy: fallback

Validate before calling

// detect over-sized metric arrays before attribution
if (metricNode.isArray() && metricNode.size() > vertexIdentifiers.size()) {
    // aggregate under table name instead of positional mapping
}

Prevention

When it happens

Trigger: Metric array for a table contains more elements than configured vertex identifiers — e.g. metrics from extra/old vertices, duplicate reporting, or configuration/parallelism drift between metric writer and REST reader.

Common situations: Job restarted with lower parallelism while old metric entries persist; duplicate table registration; engine version differences in how metric arrays are produced.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/afa4744595f4aa8a. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/service/BaseService.java:934

                    JsonNode element = metricNode.get(i);
                    if (element != null && element.isArray()) {
                        putMetricToMap(metricName, metricKey, element, tableMetricsMaps);
                    } else {
                        ArrayNode wrapped = mapper.createArrayNode();
                        wrapped.add(element);
                        putMetricToMap(metricName, metricKey, wrapped, tableMetricsMaps);
                    }
                }
            } else if (arraySize > vertexIdentifiers.size()) {
                log.error(
                        "Invalid metric array size for table '{}': received {} metric entries but only {} vertices {} configured. Using table name only.",
                        tableName,
                        arraySize,
                        vertexIdentifiers.size(),
                        vertexIdentifiers);
                putMetricToMap(metricName, tableName, metricNode, tableMetricsMaps);
            } else {
                log.warn(
                        "Metric array size mismatch for table '{}': expected {} vertices {} but got {} metric entries. Using table name only to avoid incorrect attribution.",
                        tableName,
                        vertexIdentifiers.size(),
                        vertexIdentifiers,
                        arraySize);
                putMetricToMap(metricName, tableName, metricNode, tableMetricsMaps);
            }
            return;
        }

        // Single vertex: safe to prefix.
        String metricKey = vertexIdentifiers.get(0) + "." + tableName;
        putMetricToMap(metricName, metricKey, metricNode, tableMetricsMaps);
    }

    private void putMetricToMap(
            String metricName,
            String metricKey,

View on GitHub (pinned to cf67b549a7)