{"record":{"id":"afa4744595f4aa8a","repo":"apache/seatunnel","slug":"metric-array-size-mismatch-for-table-expecte-afa474","errorCode":null,"errorMessage":"Metric array size mismatch for table '{}': expected {} vertices {} but got {} metric entries. Using table name only to avoid incorrect attribution.","messagePattern":"Metric array size mismatch for table '(.+?)': expected (.+?) vertices (.+?) but got (.+?) metric entries\\. Using table name only to avoid incorrect attribution\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/service/BaseService.java","lineNumber":934,"sourceCode":"                    JsonNode element = metricNode.get(i);\n                    if (element != null && element.isArray()) {\n                        putMetricToMap(metricName, metricKey, element, tableMetricsMaps);\n                    } else {\n                        ArrayNode wrapped = mapper.createArrayNode();\n                        wrapped.add(element);\n                        putMetricToMap(metricName, metricKey, wrapped, tableMetricsMaps);\n                    }\n                }\n            } else if (arraySize > vertexIdentifiers.size()) {\n                log.error(\n                        \"Invalid metric array size for table '{}': received {} metric entries but only {} vertices {} configured. Using table name only.\",\n                        tableName,\n                        arraySize,\n                        vertexIdentifiers.size(),\n                        vertexIdentifiers);\n                putMetricToMap(metricName, tableName, metricNode, tableMetricsMaps);\n            } else {\n                log.warn(\n                        \"Metric array size mismatch for table '{}': expected {} vertices {} but got {} metric entries. Using table name only to avoid incorrect attribution.\",\n                        tableName,\n                        vertexIdentifiers.size(),\n                        vertexIdentifiers,\n                        arraySize);\n                putMetricToMap(metricName, tableName, metricNode, tableMetricsMaps);\n            }\n            return;\n        }\n\n        // Single vertex: safe to prefix.\n        String metricKey = vertexIdentifiers.get(0) + \".\" + tableName;\n        putMetricToMap(metricName, metricKey, metricNode, tableMetricsMaps);\n    }\n\n    private void putMetricToMap(\n            String metricName,\n            String metricKey,","sourceCodeStart":916,"sourceCodeEnd":952,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/service/BaseService.java#L916-L952","documentation":"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.","triggerScenarios":"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.","commonSituations":"Job restarted with lower parallelism while old metric entries persist; duplicate table registration; engine version differences in how metric arrays are produced.","solutions":["Check raw metrics to identify the extra array entries and where they come from (stale vertices or duplicates).","Ensure the job config and the metrics store are consistent — restart metric collection for the job after parallelism changes.","Run matching SeaTunnel versions across the cluster so array layouts match the parser's expectations.","Accept table-name-level aggregation if per-vertex detail is not required; the fallback preserves the data."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// detect over-sized metric arrays before attribution\nif (metricNode.isArray() && metricNode.size() > vertexIdentifiers.size()) {\n    // aggregate under table name instead of positional mapping\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid restarting jobs with reduced parallelism over the same job ID without clearing metrics","Keep engine versions consistent cluster-wide","Deduplicate metric reporting on the writer side","Prefer table-level aggregation when array size cannot be guaranteed"],"tags":["metrics","rest-api","array-length"],"backgroundTag":"shape-mismatch","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}