{"record":{"id":"9a43f8efe3a95bcd","repo":"pentaho/pentaho-kettle","slug":"flattenermeta-exception","errorCode":"FlattenerMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository","errorMessage":"FlattenerMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository","messagePattern":"FlattenerMeta\\.Exception\\.UnexpectedErrorInReadingStepInfoFromRepository","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/flattener/FlattenerMeta.java","lineNumber":175,"sourceCode":"    retval.append( \"        </fields>\" + Const.CR );\n\n    return retval.toString();\n  }\n\n  public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {\n\n    try {\n      fieldName = rep.getStepAttributeString( id_step, \"field_name\" );\n\n      int nrvalues = rep.countNrStepAttributes( id_step, \"target_field\" );\n\n      allocate( nrvalues );\n\n      for ( int i = 0; i < nrvalues; i++ ) {\n        targetField[i] = rep.getStepAttributeString( id_step, i, \"target_field\" );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"FlattenerMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository\" ), e );\n    }\n  }\n\n  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {\n    try {\n      rep.saveStepAttribute( id_transformation, id_step, \"field_name\", fieldName );\n\n      for ( int i = 0; i < targetField.length; i++ ) {\n        rep.saveStepAttribute( id_transformation, id_step, i, \"target_field\", targetField[i] );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"FlattenerMeta.Exception.UnableToSaveStepInfoToRepository\" )\n        + id_step, e );\n    }\n  }\n","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/flattener/FlattenerMeta.java#L157-L193","documentation":"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.","triggerScenarios":"readRep when getStepAttributeString/getStepAttributeInteger throws or returns data that breaks allocate (e.g., negative nrvalues) for this id_step in the repository.","commonSituations":"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.","solutions":["Inspect the chained cause to find the underlying repository read error","Check/repair the step attribute rows for this id_step (field_name, nrvalues, target_field entries)","Reload the transformation after reconnecting to the repository","If rows are corrupt, recreate the Flattener step and re-save the transformation"],"exampleFix":"// before\nint nrvalues = (int) rep.getStepAttributeInteger( id_step, \"nrvalues\" ); // negative/corrupt -> allocate fails\n// after\nint nrvalues = (int) rep.getStepAttributeInteger( id_step, \"nrvalues\" );\nif ( nrvalues < 0 ) { nrvalues = 0; }\nallocate( nrvalues );","handlingStrategy":"try-catch","validationCode":"// before load: check repository connectivity\nif ( rep == null || !rep.isConnected() ) { throw new IllegalStateException( \"Repository not connected\" ); }","typeGuard":null,"tryCatchPattern":"try {\n  transMeta = new TransMeta( rep, metaStore, transName, null );\n} catch ( KettleException e ) {\n  logError( \"readRep failed: \" + e.getCause(), e );\n}","preventionTips":["Log and inspect getCause() on repository load failures","Verify step attribute rows after manual DB changes","Keep writer/reader PDI versions compatible","Backup the repository before upgrades or bulk edits"],"tags":["pdi","kettle","repository","metadata-load"],"backgroundTag":"file-read-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"}