pentaho/pentaho-kettle · error · KettleException

SampleRowsMeta.Exception.UnexpectedErrorReadingStepInfo

Error message

SampleRowsMeta.Exception.UnexpectedErrorReadingStepInfo

What it means

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.

Solutions

  1. Check the wrapped cause; if JDBC-related, verify repository connectivity and reconnect.
  2. Confirm id_step exists in R_STEP_ATTRIBUTE with codes 'linesrange' and 'linenumfield'.
  3. Run the repository upgrade scripts matching your Kettle version.
  4. Re-save the step from Spoon to repopulate attributes and retry.

Example fix

// before: using an id from a dropped transaction
meta.readRep(repo, metaStore, staleId, null);
// after: re-read the id from the current repository
StepMeta sm = transMeta.findStep("Sample rows");
meta.readRep(repo, metaStore, sm.getObjectId(), null);
Defensive patterns

Strategy: try-catch

Validate before calling

if (!repository.isConnected()) throw new IllegalStateException("Connect to the repository before readRep");

Type guard

if (idStep == null) throw new IllegalStateException("id_step is null; step not saved to repository");

Try / catch

try {
  meta.readRep(repository, metaStore, idStep, databases);
} catch (KettleException e) {
  log.error("SampleRows repository read failed: {}", e.getCause(), e);
  repository.connect(user, pass); // reconnect and retry once
}

Prevention

When it happens

Trigger: readRep is called while loading a transformation from a database/repository and rep.getStepAttributeString throws (connection failure, invalid id_step, backend error).

Common situations: Repository database unreachable or restarted mid-session; id_step references a deleted step; repository schema not upgraded to the running Kettle version.

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/e1743df8dbdcb8a2. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/samplerows/SampleRowsMeta.java:120

    return this.linenumfield;
  }

  public void setLineNumberField( String linenumfield ) {
    this.linenumfield = linenumfield;
  }

  public void setDefault() {
    linesrange = DEFAULT_RANGE;
    linenumfield = null;
  }

  public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
    try {
      linesrange = rep.getStepAttributeString( id_step, "linesrange" );
      linenumfield = rep.getStepAttributeString( id_step, "linenumfield" );

    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "SampleRowsMeta.Exception.UnexpectedErrorReadingStepInfo" ), e );
    }
  }

  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {
    try {
      rep.saveStepAttribute( id_transformation, id_step, "linesrange", linesrange );
      rep.saveStepAttribute( id_transformation, id_step, "linenumfield", linenumfield );

    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "SampleRowsMeta.Exception.UnexpectedErrorSavingStepInfo" ), e );
    }
  }

  public String getXML() {
    StringBuilder retval = new StringBuilder();
    retval.append( "    " + XMLHandler.addTagValue( "linesrange", linesrange ) );

View on GitHub (pinned to f3058517a1)