pentaho/pentaho-kettle · error · KettleStepException

Internal error: invalid repartitioning type: " +…

Error message

Internal error: invalid repartitioning type: " + repartitioning

What it means

In the repartitioning branch of putRow(), a switch on the step's repartitioning type dispatches to special/mirror partitioning; any unrecognized value hits the default case and throws KettleStepException 'Internal error: invalid repartitioning type: X'. It signals corrupted or out-of-range partitioning metadata, since the type constants (PARTITIONING_METHOD_NONE/SPECIAL/MIRROR) are the only valid values.

Solutions

  1. Set the partitioning method only via StepPartitioningMeta constants (PARTITIONING_METHOD_NONE, _SPECIAL, _MIRROR).
  2. Reload/re-save the transformation in Spoon to repair corrupted partition metadata.
  3. Align engine and plugin versions so partitioning constant values match.
  4. Guard: check stepPartitioningMeta.getMethod() before executing and reset to NONE if unknown.

Example fix

// before
stepMeta.setStepPartitioningMeta(new StepPartitioningMeta(99, schema));
// after
stepMeta.setStepPartitioningMeta(new StepPartitioningMeta(StepPartitioningMeta.PARTITIONING_METHOD_SPECIAL, schema));
Defensive patterns

Strategy: validation

Validate before calling

int method = stepMeta.getStepPartitioningMeta().getMethod();
if (method != StepPartitioningMeta.PARTITIONING_METHOD_NONE
 && method != StepPartitioningMeta.PARTITIONING_METHOD_SPECIAL
 && method != StepPartitioningMeta.PARTITIONING_METHOD_MIRROR) {
  stepMeta.setStepPartitioningMeta(new StepPartitioningMeta(StepPartitioningMeta.PARTITIONING_METHOD_NONE, null));
}

Try / catch

try { putRow(rowMeta, row); }
catch (KettleStepException e) { if (e.getMessage().contains("invalid repartitioning type")) { resetPartitioning(stepMeta); } else throw e; }

Prevention

When it happens

Trigger: putRow()/repartitioning path runs when StepPartitioningMeta's method field holds a value outside the known constants — from programmatically setting an invalid partitioning method, corrupt metadata, or a constant mismatch between plugin and engine versions.

Common situations: Custom plugin steps setting partitioning method via a raw integer; .ktr files edited/migrated between Kettle versions; serializing partition metadata incorrectly.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/step/BaseStep.java:1345

      }

      // Repartitioning happens when the current step is not partitioned, but the next one is.
      // That means we need to look up the partitioning information in the next step..
      // If there are multiple steps, we need to look at the first (they should be all the same)
      //
      switch ( repartitioning ) {
        case StepPartitioningMeta.PARTITIONING_METHOD_NONE:
          noPartitioning( rowMeta, row );
          break;

        case StepPartitioningMeta.PARTITIONING_METHOD_SPECIAL:
          specialPartitioning( rowMeta, row );
          break;
        case StepPartitioningMeta.PARTITIONING_METHOD_MIRROR:
          mirrorPartitioning( rowMeta, row );
          break;
        default:
          throw new KettleStepException( "Internal error: invalid repartitioning type: " + repartitioning );
      }
    } finally {
      outputRowSetsLock.readLock().unlock();
    }
  }

  /**
   * Copy always to all target steps/copies
   */
  private void mirrorPartitioning( RowMetaInterface rowMeta, Object[] row ) {
    for ( RowSet rowSet : outputRowSets ) {
      putRowToRowSet( rowSet, rowMeta, row );
    }
  }

  private void specialPartitioning( RowMetaInterface rowMeta, Object[] row ) throws KettleStepException {
    if ( nextStepPartitioningMeta == null ) {
      // Look up the partitioning of the next step.

View on GitHub (pinned to f3058517a1)