{"record":{"id":"3352e4ba20651724","repo":"pentaho/pentaho-kettle","slug":"the-number-of-reference-entries-0-is-not-the-same-as-the","errorCode":null,"errorMessage":"The number of reference entries ({0}) is not the same as the number of compare entries({1})","messagePattern":"The number of reference entries \\((.+?)\\) is not the same as the number of compare entries\\((.+?)\\)","errorType":"validation","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/step/StepInjectionUtil.java","lineNumber":91,"sourceCode":"        return entry;\n      }\n    }\n    return null;\n  }\n\n  /**\n   * This method compares 2 sets of step injection meta entries. They have to be in the same order.\n   * We will traverse into nested details.\n   *\n   * @param refEntries The reference list\n   * @param cmpEntries The list to compare\n   * @throws KettleException\n   */\n  public static void compareEntryValues( List<StepInjectionMetaEntry> refEntries,\n    List<StepInjectionMetaEntry> cmpEntries ) throws KettleException {\n\n    if ( refEntries.size() != cmpEntries.size() ) {\n      throw new KettleException( \"The number of reference entries (\" + refEntries.size()\n        + \") is not the same as the number of compare entries(\" + cmpEntries.size() + \")\" );\n    }\n\n    for ( int i = 0; i < refEntries.size(); i++ ) {\n      StepInjectionMetaEntry refEntry = refEntries.get( i );\n      StepInjectionMetaEntry cmpEntry = cmpEntries.get( i );\n      if ( cmpEntry.getValueType() == ValueMetaInteger.TYPE_NONE ) {\n        compareEntryValues( refEntry.getDetails(), cmpEntry.getDetails() );\n      } else {\n        Object ref = refEntry.getValue();\n        Object cmp = cmpEntry.getValue();\n        if ( ref != null && cmp == null ) {\n          throw new KettleException( \"Reference key '\" + refEntry.getKey()\n            + \"': value is not null while the compare value is null\" );\n        }\n        if ( ref == null && cmp != null ) {\n          throw new KettleException( \"Reference key '\" + refEntry.getKey()\n            + \"': value is null while the compare value is not null\" );","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/step/StepInjectionUtil.java#L73-L109","documentation":"StepInjectionUtil.compareEntryValues recursively compares two step injection metadata trees. It first asserts that the reference and compare entry lists have equal size; if not, the trees are structurally different and comparison cannot proceed, so a KettleException is thrown with both sizes.","triggerScenarios":"Calling StepInjectionUtil.compareEntryValues(refEntries, cmpEntries) where the two lists contain different numbers of StepInjectionMetaEntry objects, e.g. one step meta version declares extra attributes versus the other.","commonSituations":"Comparing metadata produced by two different versions of a step plugin (attributes added/removed between releases), or comparing against a reference snapshot after editing a transformation.","solutions":["Regenerate the compare entries with the same plugin version that produced the reference entries.","Diff the two entry key sets to find the added/removed attribute and update the reference accordingly.","If intentional, use a comparison routine tolerant of structural differences instead of compareEntryValues.","Align both sides by loading both metas from the same repository/plugin configuration."],"exampleFix":"// before\ncompareEntryValues(oldMeta.getStepInjectionMetadataEntries(), newMeta.getStepInjectionMetadataEntries());\n// after\nif (oldMeta.getClass().equals(newMeta.getClass())) {\n  compareEntryValues(oldMeta.getStepInjectionMetadataEntries(), newMeta.getStepInjectionMetadataEntries());\n}","handlingStrategy":"validation","validationCode":"// Compare list sizes before calling the utility\nList<StepInjectionMetaEntry> ref = refMeta.getStepInjectionMetadataEntries();\nList<StepInjectionMetaEntry> cmp = cmpMeta.getStepInjectionMetadataEntries();\nif (ref.size() != cmp.size()) { log.warn(\"Entry count differs: \" + ref.size() + \" vs \" + cmp.size()); }","typeGuard":null,"tryCatchPattern":"try { StepInjectionUtil.compareEntryValues(ref, cmp); } catch (KettleException e) { if (e.getMessage().contains(\"is not the same as the number of compare entries\")) { log.error(\"Structural metadata drift between plugin versions: \" + e.getMessage()); } else { throw e; } }","preventionTips":["Pin both sides to the same plugin version before comparing","Regenerate reference snapshots whenever step attributes change","Add a CI check that entry counts match across environments"],"tags":["kettle","metadata-injection","comparison","size-mismatch"],"backgroundTag":"shape-mismatch","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}