pentaho/pentaho-kettle · error · KettleException

FlattenerMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository

FlattenerMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository

Error message

FlattenerMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository

What it means

FlattenerMeta.readRep wraps any exception while loading the Flattener's field_name and target_field list from repository step attributes in a KettleException with this localized message; the underlying repository error is chained.

Solutions

  1. Inspect the chained cause to find the underlying repository read error
  2. Check/repair the step attribute rows for this id_step (field_name, nrvalues, target_field entries)
  3. Reload the transformation after reconnecting to the repository
  4. If rows are corrupt, recreate the Flattener step and re-save the transformation

Example fix

// before
int nrvalues = (int) rep.getStepAttributeInteger( id_step, "nrvalues" ); // negative/corrupt -> allocate fails
// after
int nrvalues = (int) rep.getStepAttributeInteger( id_step, "nrvalues" );
if ( nrvalues < 0 ) { nrvalues = 0; }
allocate( nrvalues );
Defensive patterns

Strategy: try-catch

Validate before calling

// before load: check repository connectivity
if ( rep == null || !rep.isConnected() ) { throw new IllegalStateException( "Repository not connected" ); }

Try / catch

try {
  transMeta = new TransMeta( rep, metaStore, transName, null );
} catch ( KettleException e ) {
  logError( "readRep failed: " + e.getCause(), e );
}

Prevention

When it happens

Trigger: readRep when getStepAttributeString/getStepAttributeInteger throws or returns data that breaks allocate (e.g., negative nrvalues) for this id_step in the repository.

Common situations: Corrupt r_step_attribute rows for the step; attributes written by an incompatible PDI version; transient repository connection failures while opening a transformation stored in a database repository.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/flattener/FlattenerMeta.java:175

    retval.append( "        </fields>" + Const.CR );

    return retval.toString();
  }

  public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {

    try {
      fieldName = rep.getStepAttributeString( id_step, "field_name" );

      int nrvalues = rep.countNrStepAttributes( id_step, "target_field" );

      allocate( nrvalues );

      for ( int i = 0; i < nrvalues; i++ ) {
        targetField[i] = rep.getStepAttributeString( id_step, i, "target_field" );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "FlattenerMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository" ), e );
    }
  }

  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {
    try {
      rep.saveStepAttribute( id_transformation, id_step, "field_name", fieldName );

      for ( int i = 0; i < targetField.length; i++ ) {
        rep.saveStepAttribute( id_transformation, id_step, i, "target_field", targetField[i] );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "FlattenerMeta.Exception.UnableToSaveStepInfoToRepository" )
        + id_step, e );
    }
  }

View on GitHub (pinned to f3058517a1)