pentaho/pentaho-kettle · error · KettleException

ERROR0002.UnexpectedErrorReadingFromTheRepository

ERROR0002.UnexpectedErrorReadingFromTheRepository

Error message

DatabaseLookupMeta.ERROR0002.UnexpectedErrorReadingFromTheRepository

What it means

DatabaseLookupMeta's repository-loading constructor wraps any exception thrown while reading the step's attributes (key/value fields, conditions, orderby, schema/table, return value names/defaults/types) into a KettleException 'Unexpected error reading step information from the repository'.

Solutions

  1. Check the nested cause for the precise repository/ValueMetaFactory failure
  2. Verify the step's attributes exist in the repository (re-save the transformation from Spoon)
  3. Fix any unrecognized return-value type strings stored for the step
  4. Test repository connectivity and retry the load

Example fix

// before
returnValueDefaultType[i] = ValueMetaFactory.getIdForValueMeta(
  rep.getStepAttributeString( id_step, i, TAG_RETURN_VALUE_TYPE ) );
// after
String t = rep.getStepAttributeString( id_step, i, TAG_RETURN_VALUE_TYPE );
Integer tid = t == null ? null : ValueMetaFactory.getIdForValueMeta( t );
returnValueDefaultType[i] = tid == null ? ValueMetaInterface.TYPE_STRING : tid;
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure repository connectivity before loading transformation metadata
if ( rep == null || !rep.isConnected() ) throw new KettleException( "Repository not connected" );

Type guard

boolean isValidTypeName( String t ) {
  try { return t != null && ValueMetaFactory.getIdForValueMeta( t ) != null; }
  catch ( Exception e ) { return false; }
}

Try / catch

try {
  transMeta = new TransMeta( rep, transId, variableSpace );
} catch ( KettleException e ) {
  if ( e.getMessage() != null && e.getMessage().contains( "reading step information from the repository" ) ) {
    logError( "DatabaseLookupMeta read failed; cause=" + e.getCause(), e );
  } else { throw e; }
}

Prevention

When it happens

Trigger: Constructing DatabaseLookupMeta from a repository (transformation load) when rep.getStepAttributeString/Integer fails, ValueMetaFactory.getIdForValueMeta cannot resolve a stored return-value type name, or the repo connection breaks mid-read.

Common situations: Repository row for the step is incomplete after an interrupted save; return-value type strings from a different Kettle version; transient repository DB outage.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupMeta.java:591

      allocate( nrKeys, nrValues );

      for ( int i = 0; i < nrKeys; i++ ) {
        streamKeyField1[ i ] = rep.getStepAttributeString( id_step, i, TAG_LOOKUP_KEY_NAME );
        tableKeyField[ i ] = rep.getStepAttributeString( id_step, i, TAG_LOOKUP_KEY_FIELD );
        keyCondition[ i ] = rep.getStepAttributeString( id_step, i, TAG_LOOKUP_KEY_CONDITION );
        streamKeyField2[ i ] = rep.getStepAttributeString( id_step, i, TAG_LOOKUP_KEY_NAME2 );
      }

      for ( int i = 0; i < nrValues; i++ ) {
        returnValueField[ i ] = rep.getStepAttributeString( id_step, i, TAG_RETURN_VALUE_NAME );
        returnValueNewName[ i ] = rep.getStepAttributeString( id_step, i, TAG_RETURN_VALUE_RENAME );
        returnValueDefault[ i ] = rep.getStepAttributeString( id_step, i, TAG_RETURN_VALUE_DEFAULT );
        returnValueDefaultType[ i ] =
          ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, TAG_RETURN_VALUE_TYPE ) );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "DatabaseLookupMeta.ERROR0002.UnexpectedErrorReadingFromTheRepository" ), e );
    }
  }

  @Override
  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId idTransformation, ObjectId idStep ) throws KettleException {
    try {
      rep.saveDatabaseMetaStepAttribute( idTransformation, idStep, "id_connection", databaseMeta );
      rep.saveStepAttribute( idTransformation, idStep, TAG_CACHE, cached );
      rep.saveStepAttribute( idTransformation, idStep, TAG_CACHE_LOAD_ALL, loadingAllDataInCache );
      rep.saveStepAttribute( idTransformation, idStep, TAG_CACHE_SIZE, cacheSize );
      rep.saveStepAttribute( idTransformation, idStep, TAG_LOOKUP_SCHEMA, schemaName );
      rep.saveStepAttribute( idTransformation, idStep, TAG_LOOKUP_TABLE, tablename );
      rep.saveStepAttribute( idTransformation, idStep, TAG_LOOKUP_ORDERBY, orderByClause );
      rep.saveStepAttribute( idTransformation, idStep, TAG_FAIL_ON_MULTIPLE, failingOnMultipleResults );
      rep.saveStepAttribute( idTransformation, idStep, TAG_EAT_ROW_ON_FAILURE, eatingRowOnLookupFailure );

      for ( int i = 0; i < streamKeyField1.length; i++ ) {

View on GitHub (pinned to f3058517a1)