{"record":{"id":"42668c470c2da3d5","repo":"pentaho/pentaho-kettle","slug":"sasinputmeta-exception-unabletosavemetadatatorepository","errorCode":"SASInputMeta.Exception.UnableToSaveMetaDataToRepository","errorMessage":"SASInputMeta.Exception.UnableToSaveMetaDataToRepository","messagePattern":"SASInputMeta\\.Exception\\.UnableToSaveMetaDataToRepository","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputMeta.java","lineNumber":149,"sourceCode":"      outputFields = new ArrayList<SasInputField>();\n      int nrFields = rep.countNrStepAttributes( stepId, \"field_name\" );\n      for ( int i = 0; i < nrFields; i++ ) {\n        outputFields.add( new SasInputField( rep, stepId, i ) );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"SASInputMeta.Exception.UnexpectedErrorReadingMetaDataFromRepository\" ), 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, \"accept_field\", acceptingField );\n      for ( int i = 0; i < outputFields.size(); i++ ) {\n        outputFields.get( i ).saveRep( rep, metaStore, id_transformation, id_step, i );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"SASInputMeta.Exception.UnableToSaveMetaDataToRepository\" )\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\n    CheckResult cr;\n\n    if ( Utils.isEmpty( getAcceptingField() ) ) {\n      cr =\n        new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(\n          PKG, \"SASInput.Log.Error.InvalidAcceptingFieldName\" ), stepMeta );\n      remarks.add( cr );\n    }\n  }","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputMeta.java#L131-L167","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the repository connection (database up, network reachable, credentials valid) and retry the save.","Verify the Kettle repository schema is installed and writable; run the repository upgrade/repair if needed.","Inspect the wrapped cause exception (getCause()) for the real repository error and address it.","As a workaround, save the transformation to a file (XML) instead of the repository."],"exampleFix":"// before: saving with a stale repository connection\ntransMeta.saveRep(rep, repositoryDirectory, transName, null);\n// after: reconnect/validate the repository before saving\nif (!rep.isConnected()) { rep.connect(); }\ntransMeta.saveRep(rep, repositoryDirectory, transName, null);","handlingStrategy":"try-catch","validationCode":"if (rep == null || !rep.isConnected()) { rep.connect(); }\n// then attempt save","typeGuard":"boolean canSave(Repository rep) { return rep != null && rep.isConnected(); }","tryCatchPattern":"try {\n  transMeta.saveRep(rep, dir, name, version);\n} catch (KettleException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"UnableToSaveMetaDataToRepository\")) {\n    logError(\"Repository save failed: \" + e.getCause(), e);\n    rep.disconnect(); rep.connect(); // retry once\n  } else { throw e; }\n}","preventionTips":["Keep the repository connection alive (check connectivity before long editing sessions).","Confirm the repository schema is installed/upgraded to your Pentaho version.","Verify write permissions on the target repository directory.","Use file-based (XML) storage when repository connectivity is unreliable."],"tags":["kettle","repository","metadata","persistence"],"backgroundTag":"database-write-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"}