pentaho/pentaho-kettle · error · KettleException

The number of reference entries

Error message

The number of reference entries ({0}) is not the same as the number of compare entries({1})

What it means

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.

Solutions

  1. Regenerate the compare entries with the same plugin version that produced the reference entries.
  2. Diff the two entry key sets to find the added/removed attribute and update the reference accordingly.
  3. If intentional, use a comparison routine tolerant of structural differences instead of compareEntryValues.
  4. Align both sides by loading both metas from the same repository/plugin configuration.

Example fix

// before
compareEntryValues(oldMeta.getStepInjectionMetadataEntries(), newMeta.getStepInjectionMetadataEntries());
// after
if (oldMeta.getClass().equals(newMeta.getClass())) {
  compareEntryValues(oldMeta.getStepInjectionMetadataEntries(), newMeta.getStepInjectionMetadataEntries());
}
Defensive patterns

Strategy: validation

Validate before calling

// Compare list sizes before calling the utility
List<StepInjectionMetaEntry> ref = refMeta.getStepInjectionMetadataEntries();
List<StepInjectionMetaEntry> cmp = cmpMeta.getStepInjectionMetadataEntries();
if (ref.size() != cmp.size()) { log.warn("Entry count differs: " + ref.size() + " vs " + cmp.size()); }

Try / catch

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; } }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/3352e4ba20651724. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/step/StepInjectionUtil.java:91

        return entry;
      }
    }
    return null;
  }

  /**
   * This method compares 2 sets of step injection meta entries. They have to be in the same order.
   * We will traverse into nested details.
   *
   * @param refEntries The reference list
   * @param cmpEntries The list to compare
   * @throws KettleException
   */
  public static void compareEntryValues( List<StepInjectionMetaEntry> refEntries,
    List<StepInjectionMetaEntry> cmpEntries ) throws KettleException {

    if ( refEntries.size() != cmpEntries.size() ) {
      throw new KettleException( "The number of reference entries (" + refEntries.size()
        + ") is not the same as the number of compare entries(" + cmpEntries.size() + ")" );
    }

    for ( int i = 0; i < refEntries.size(); i++ ) {
      StepInjectionMetaEntry refEntry = refEntries.get( i );
      StepInjectionMetaEntry cmpEntry = cmpEntries.get( i );
      if ( cmpEntry.getValueType() == ValueMetaInteger.TYPE_NONE ) {
        compareEntryValues( refEntry.getDetails(), cmpEntry.getDetails() );
      } else {
        Object ref = refEntry.getValue();
        Object cmp = cmpEntry.getValue();
        if ( ref != null && cmp == null ) {
          throw new KettleException( "Reference key '" + refEntry.getKey()
            + "': value is not null while the compare value is null" );
        }
        if ( ref == null && cmp != null ) {
          throw new KettleException( "Reference key '" + refEntry.getKey()
            + "': value is null while the compare value is not null" );

View on GitHub (pinned to f3058517a1)