{"record":{"id":"4a664574aad1d12b","repo":"pentaho/pentaho-kettle","slug":"error0002-unexpectederrorreadingfromtherepository","errorCode":"ERROR0002.UnexpectedErrorReadingFromTheRepository","errorMessage":"DatabaseLookupMeta.ERROR0002.UnexpectedErrorReadingFromTheRepository","messagePattern":"DatabaseLookupMeta\\.ERROR0002\\.UnexpectedErrorReadingFromTheRepository","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupMeta.java","lineNumber":591,"sourceCode":"\n      allocate( nrKeys, nrValues );\n\n      for ( int i = 0; i < nrKeys; i++ ) {\n        streamKeyField1[ i ] = rep.getStepAttributeString( id_step, i, TAG_LOOKUP_KEY_NAME );\n        tableKeyField[ i ] = rep.getStepAttributeString( id_step, i, TAG_LOOKUP_KEY_FIELD );\n        keyCondition[ i ] = rep.getStepAttributeString( id_step, i, TAG_LOOKUP_KEY_CONDITION );\n        streamKeyField2[ i ] = rep.getStepAttributeString( id_step, i, TAG_LOOKUP_KEY_NAME2 );\n      }\n\n      for ( int i = 0; i < nrValues; i++ ) {\n        returnValueField[ i ] = rep.getStepAttributeString( id_step, i, TAG_RETURN_VALUE_NAME );\n        returnValueNewName[ i ] = rep.getStepAttributeString( id_step, i, TAG_RETURN_VALUE_RENAME );\n        returnValueDefault[ i ] = rep.getStepAttributeString( id_step, i, TAG_RETURN_VALUE_DEFAULT );\n        returnValueDefaultType[ i ] =\n          ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, TAG_RETURN_VALUE_TYPE ) );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"DatabaseLookupMeta.ERROR0002.UnexpectedErrorReadingFromTheRepository\" ), e );\n    }\n  }\n\n  @Override\n  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId idTransformation, ObjectId idStep ) throws KettleException {\n    try {\n      rep.saveDatabaseMetaStepAttribute( idTransformation, idStep, \"id_connection\", databaseMeta );\n      rep.saveStepAttribute( idTransformation, idStep, TAG_CACHE, cached );\n      rep.saveStepAttribute( idTransformation, idStep, TAG_CACHE_LOAD_ALL, loadingAllDataInCache );\n      rep.saveStepAttribute( idTransformation, idStep, TAG_CACHE_SIZE, cacheSize );\n      rep.saveStepAttribute( idTransformation, idStep, TAG_LOOKUP_SCHEMA, schemaName );\n      rep.saveStepAttribute( idTransformation, idStep, TAG_LOOKUP_TABLE, tablename );\n      rep.saveStepAttribute( idTransformation, idStep, TAG_LOOKUP_ORDERBY, orderByClause );\n      rep.saveStepAttribute( idTransformation, idStep, TAG_FAIL_ON_MULTIPLE, failingOnMultipleResults );\n      rep.saveStepAttribute( idTransformation, idStep, TAG_EAT_ROW_ON_FAILURE, eatingRowOnLookupFailure );\n\n      for ( int i = 0; i < streamKeyField1.length; i++ ) {","sourceCodeStart":573,"sourceCodeEnd":609,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupMeta.java#L573-L609","documentation":"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'.","triggerScenarios":"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.","commonSituations":"Repository row for the step is incomplete after an interrupted save; return-value type strings from a different Kettle version; transient repository DB outage.","solutions":["Check the nested cause for the precise repository/ValueMetaFactory failure","Verify the step's attributes exist in the repository (re-save the transformation from Spoon)","Fix any unrecognized return-value type strings stored for the step","Test repository connectivity and retry the load"],"exampleFix":"// before\nreturnValueDefaultType[i] = ValueMetaFactory.getIdForValueMeta(\n  rep.getStepAttributeString( id_step, i, TAG_RETURN_VALUE_TYPE ) );\n// after\nString t = rep.getStepAttributeString( id_step, i, TAG_RETURN_VALUE_TYPE );\nInteger tid = t == null ? null : ValueMetaFactory.getIdForValueMeta( t );\nreturnValueDefaultType[i] = tid == null ? ValueMetaInterface.TYPE_STRING : tid;","handlingStrategy":"try-catch","validationCode":"// ensure repository connectivity before loading transformation metadata\nif ( rep == null || !rep.isConnected() ) throw new KettleException( \"Repository not connected\" );","typeGuard":"boolean isValidTypeName( String t ) {\n  try { return t != null && ValueMetaFactory.getIdForValueMeta( t ) != null; }\n  catch ( Exception e ) { return false; }\n}","tryCatchPattern":"try {\n  transMeta = new TransMeta( rep, transId, variableSpace );\n} catch ( KettleException e ) {\n  if ( e.getMessage() != null && e.getMessage().contains( \"reading step information from the repository\" ) ) {\n    logError( \"DatabaseLookupMeta read failed; cause=\" + e.getCause(), e );\n  } else { throw e; }\n}","preventionTips":["Inspect getCause() — it reveals whether repo access or a type-name conversion failed","Avoid interrupted saves that leave partial step attribute rows","Keep return-value type names valid across Kettle versions","Verify repo connectivity before batch transformation loads"],"tags":["kettle","repository","deserialization"],"backgroundTag":"database-query-failed","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"}