pentaho/pentaho-kettle · error · KettleException

SampleRowsMeta.Exception.UnexpectedErrorSavingStepInfo

Error message

SampleRowsMeta.Exception.UnexpectedErrorSavingStepInfo

What it means

KettleException thrown by SampleRowsMeta.saveRep when saving the Sample Rows step's attributes (linesrange, linenumfield) to the repository fails. The localized message SampleRowsMeta.Exception.UnexpectedErrorSavingStepInfo wraps the original repository exception.

Solutions

  1. Examine the wrapped cause; fix the underlying DB issue (connectivity, privileges, disk space).
  2. Reconnect to the repository and retry the save.
  3. Check for conflicting rows in R_STEP_ATTRIBUTE for the same id_step and remove duplicates.
  4. As a workaround, save the transformation as XML to avoid losing work while repository access is fixed.

Example fix

// before: saving while repository session expired
transMeta.saveRepo(repo, null); // KettleException: UnexpectedErrorSavingStepInfo
// after: reconnect first
if (!repo.isConnected()) repo.connect(user, pass);
transMeta.saveRepo(repo, null);
Defensive patterns

Strategy: try-catch

Validate before calling

if (repository == null || !repository.isConnected()) {
  throw new IllegalStateException("Repository must be connected before saving");
}

Type guard

if (linesrange == null || !linesrange.matches("^\\d+\\.\\.\\d+$")) { log.warn("linesrange not set; saving null attribute"); }

Try / catch

try {
  meta.saveRep(repository, metaStore, idTransformation, idStep);
} catch (KettleException e) {
  log.error("SampleRows repository save failed: {}", e.getCause(), e);
  transMeta.saveXML(new File("backup.ktr"), "no-overwrite"); // don't lose work
}

Prevention

When it happens

Trigger: saveRep runs during a transformation save and rep.saveStepAttribute throws due to a repository write failure (connection loss, permissions, constraint violation on R_STEP_ATTRIBUTE).

Common situations: Repository DB read-only or full; network drop between Spoon and repository database; DB user lacking INSERT/UPDATE grants; concurrent edits causing lock or key conflicts.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/835946ac3f78d3e2. Report an issue: GitHub.

Appendix: source

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

  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 ) );
    retval.append( "    " + XMLHandler.addTagValue( "linenumfield", linenumfield ) );

    return retval.toString();
  }

  public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
    Repository repository, IMetaStore metaStore ) {
    CheckResult cr;

    if ( Utils.isEmpty( linesrange ) ) {

View on GitHub (pinned to f3058517a1)