{"record":{"id":"e1743df8dbdcb8a2","repo":"pentaho/pentaho-kettle","slug":"samplerowsmeta-exception-unexpectederrorreadingstepinfo","errorCode":null,"errorMessage":"SampleRowsMeta.Exception.UnexpectedErrorReadingStepInfo","messagePattern":"SampleRowsMeta\\.Exception\\.UnexpectedErrorReadingStepInfo","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/samplerows/SampleRowsMeta.java","lineNumber":120,"sourceCode":"    return this.linenumfield;\n  }\n\n  public void setLineNumberField( String linenumfield ) {\n    this.linenumfield = linenumfield;\n  }\n\n  public void setDefault() {\n    linesrange = DEFAULT_RANGE;\n    linenumfield = null;\n  }\n\n  public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {\n    try {\n      linesrange = rep.getStepAttributeString( id_step, \"linesrange\" );\n      linenumfield = rep.getStepAttributeString( id_step, \"linenumfield\" );\n\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"SampleRowsMeta.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, \"linesrange\", linesrange );\n      rep.saveStepAttribute( id_transformation, id_step, \"linenumfield\", linenumfield );\n\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"SampleRowsMeta.Exception.UnexpectedErrorSavingStepInfo\" ), e );\n    }\n  }\n\n  public String getXML() {\n    StringBuilder retval = new StringBuilder();\n    retval.append( \"    \" + XMLHandler.addTagValue( \"linesrange\", linesrange ) );","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/samplerows/SampleRowsMeta.java#L102-L138","documentation":"KettleException thrown by SampleRowsMeta.readRep when loading the Sample Rows step's attributes (linesrange, linenumfield) from a repository fails. The message is the localized SampleRowsMeta.Exception.UnexpectedErrorReadingStepInfo and wraps the repository exception.","triggerScenarios":"readRep is called while loading a transformation from a database/repository and rep.getStepAttributeString throws (connection failure, invalid id_step, backend error).","commonSituations":"Repository database unreachable or restarted mid-session; id_step references a deleted step; repository schema not upgraded to the running Kettle version.","solutions":["Check the wrapped cause; if JDBC-related, verify repository connectivity and reconnect.","Confirm id_step exists in R_STEP_ATTRIBUTE with codes 'linesrange' and 'linenumfield'.","Run the repository upgrade scripts matching your Kettle version.","Re-save the step from Spoon to repopulate attributes and retry."],"exampleFix":"// before: using an id from a dropped transaction\nmeta.readRep(repo, metaStore, staleId, null);\n// after: re-read the id from the current repository\nStepMeta sm = transMeta.findStep(\"Sample rows\");\nmeta.readRep(repo, metaStore, sm.getObjectId(), null);","handlingStrategy":"try-catch","validationCode":"if (!repository.isConnected()) throw new IllegalStateException(\"Connect to the repository before readRep\");","typeGuard":"if (idStep == null) throw new IllegalStateException(\"id_step is null; step not saved to repository\");","tryCatchPattern":"try {\n  meta.readRep(repository, metaStore, idStep, databases);\n} catch (KettleException e) {\n  log.error(\"SampleRows repository read failed: {}\", e.getCause(), e);\n  repository.connect(user, pass); // reconnect and retry once\n}","preventionTips":["Verify repository connectivity before loading transformations.","Never reference id_step values from dropped transactions.","Upgrade the repository schema in lockstep with Kettle.","Add a reconnect/retry wrapper around repository reads."],"tags":["kettle","repository","metadata","persistence"],"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"}