pentaho/pentaho-kettle · error · KettleException

SASInputMeta.Exception.UnableToSaveMetaDataToRepository

SASInputMeta.Exception.UnableToSaveMetaDataToRepository

Error message

SASInputMeta.Exception.UnableToSaveMetaDataToRepository

What it means

Thrown by SasInputMeta.saveRep when persisting the SAS input step's metadata (the 'accept_field' attribute and each output field definition) to the Kettle repository fails. It is a KettleException wrapper around the underlying repository exception, with the step id appended to the message. It indicates a repository I/O or connectivity problem, not a problem with the transformation logic itself.

Solutions

  1. Check the repository connection (database up, network reachable, credentials valid) and retry the save.
  2. Verify the Kettle repository schema is installed and writable; run the repository upgrade/repair if needed.
  3. Inspect the wrapped cause exception (getCause()) for the real repository error and address it.
  4. As a workaround, save the transformation to a file (XML) instead of the repository.

Example fix

// before: saving with a stale repository connection
transMeta.saveRep(rep, repositoryDirectory, transName, null);
// after: reconnect/validate the repository before saving
if (!rep.isConnected()) { rep.connect(); }
transMeta.saveRep(rep, repositoryDirectory, transName, null);
Defensive patterns

Strategy: try-catch

Validate before calling

if (rep == null || !rep.isConnected()) { rep.connect(); }
// then attempt save

Type guard

boolean canSave(Repository rep) { return rep != null && rep.isConnected(); }

Try / catch

try {
  transMeta.saveRep(rep, dir, name, version);
} catch (KettleException e) {
  if (e.getMessage() != null && e.getMessage().contains("UnableToSaveMetaDataToRepository")) {
    logError("Repository save failed: " + e.getCause(), e);
    rep.disconnect(); rep.connect(); // retry once
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling saveRep (directly or via a repository save of a transformation containing a SAS Input step) when rep.saveStepAttribute(...) or outputFields.get(i).saveRep(...) throws any Exception, e.g. the repository connection is down or the repository write fails.

Common situations: Saving a transformation while the database/repository connection has been dropped or timed out; saving to a read-only repository; a corrupted repository schema; network interruption between the Spoon client and the metadata repository.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputMeta.java:149

      outputFields = new ArrayList<SasInputField>();
      int nrFields = rep.countNrStepAttributes( stepId, "field_name" );
      for ( int i = 0; i < nrFields; i++ ) {
        outputFields.add( new SasInputField( rep, stepId, i ) );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "SASInputMeta.Exception.UnexpectedErrorReadingMetaDataFromRepository" ), e );
    }
  }

  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {
    try {
      rep.saveStepAttribute( id_transformation, id_step, "accept_field", acceptingField );
      for ( int i = 0; i < outputFields.size(); i++ ) {
        outputFields.get( i ).saveRep( rep, metaStore, id_transformation, id_step, i );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "SASInputMeta.Exception.UnableToSaveMetaDataToRepository" )
        + id_step, e );
    }
  }

  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( getAcceptingField() ) ) {
      cr =
        new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(
          PKG, "SASInput.Log.Error.InvalidAcceptingFieldName" ), stepMeta );
      remarks.add( cr );
    }
  }

View on GitHub (pinned to f3058517a1)