{"record":{"id":"f209ee9495e4d75e","repo":"pentaho/pentaho-kettle","slug":"detectlastrowmeta-exception-unexpectederrorreadingstepinfo","errorCode":"DetectLastRowMeta.Exception.UnexpectedErrorReadingStepInfo","errorMessage":"DetectLastRowMeta.Exception.UnexpectedErrorReadingStepInfo","messagePattern":"DetectLastRowMeta\\.Exception\\.UnexpectedErrorReadingStepInfo","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRowMeta.java","lineNumber":116,"sourceCode":"    StringBuilder retval = new StringBuilder();\n    retval.append( \"    \" + XMLHandler.addTagValue( \"resultfieldname\", resultfieldname ) );\n    return retval.toString();\n  }\n\n  private void readData( Node stepnode ) throws KettleXMLException {\n    try {\n      resultfieldname = XMLHandler.getTagValue( stepnode, \"resultfieldname\" );\n    } catch ( Exception e ) {\n      throw new KettleXMLException( BaseMessages.getString(\n        PKG, \"DetectLastRowMeta.Exception.UnableToReadStepInfo\" ), e );\n    }\n  }\n\n  public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {\n    try {\n      resultfieldname = rep.getStepAttributeString( id_step, \"resultfieldname\" );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"DetectLastRowMeta.Exception.UnexpectedErrorReadingStepInfo\" ), 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, \"resultfieldname\", resultfieldname );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"DetectLastRowMeta.Exception.UnableToSaveStepInfo\" )\n        + id_step, e );\n    }\n  }\n\n  public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,\n    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,\n    Repository repository, IMetaStore metaStore ) {\n    CheckResult cr;\n    String error_message = \"\";","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRowMeta.java#L98-L134","documentation":"DetectLastRowMeta.readRep wraps any exception while reading the step's attributes from a Kettle repository into a generic KettleException with this localized message. It indicates the repository read of resultfieldname (or other attributes) failed unexpectedly, with the cause chained.","triggerScenarios":"Loading a transformation from a repository (StepMeta repository load path calls readRep) when rep.getStepAttributeString throws: repository connection failure, missing step row, or repository plugin error.","commonSituations":"Repository database unreachable during load; r_step_attribute rows missing or corrupted for the step; permission issues on repository tables; version mismatch between client and repository schema.","solutions":["Inspect the chained cause for the underlying repository/database error","Verify repository connectivity and credentials","Check that the step row and its attribute rows exist in the repository","Re-create the step in Spoon and re-save if repository data is corrupted"],"exampleFix":"// before\n} catch ( Exception e ) {\n  throw new KettleException( BaseMessages.getString( PKG, \"DetectLastRowMeta.Exception.UnexpectedErrorReadingStepInfo\" ), e );\n}\n// after: log cause for diagnosis\n} catch ( Exception e ) {\n  logError( \"Repository read failed for DetectLastRow step \" + id_step, e );\n  throw new KettleException( BaseMessages.getString( PKG, \"DetectLastRowMeta.Exception.UnexpectedErrorReadingStepInfo\" ), e );\n}","handlingStrategy":"try-catch","validationCode":"// before loading from repository, verify connection\nif ( repository == null || !repository.isConnected() ) {\n  throw new KettleException(\"Repository not connected; cannot load transformation\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  transMeta = TransMetaFactory.loadTransformation(rep, path, metaStore, true, variables);\n} catch (KettleException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"UnexpectedErrorReadingStepInfo\")) {\n    log.error(\"Repository read failed for DetectLastRow step; cause: \" + e.getCause(), e);\n  }\n  throw e;\n}","preventionTips":["Check repository health/permissions before loading","Keep client and repository schema versions aligned","Back up r_step_attribute data before repository maintenance","Always log getCause() for the underlying error"],"tags":["kettle","repository","persistence","step-metadata"],"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"}