{"record":{"id":"5003d4d6792623eb","repo":"pentaho/pentaho-kettle","slug":"tableexistsmeta-exception-unabletosavestepinfo","errorCode":null,"errorMessage":"TableExistsMeta.Exception.UnableToSaveStepInfo","messagePattern":"TableExistsMeta\\.Exception\\.UnableToSaveStepInfo","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExistsMeta.java","lineNumber":197,"sourceCode":"      throw new KettleException( BaseMessages.getString(\n        PKG, \"TableExistsMeta.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.saveDatabaseMetaStepAttribute( id_transformation, id_step, \"id_connection\", databaseMeta );\n      rep.saveStepAttribute( id_transformation, id_step, \"tablenamefield\", tablenamefield );\n      rep.saveStepAttribute( id_transformation, id_step, \"schemaname\", schemaname );\n\n      rep.saveStepAttribute( id_transformation, id_step, \"resultfieldname\", resultfieldname );\n\n      // Also, save the step-database relationship!\n      if ( databaseMeta != null ) {\n        rep.insertStepDatabase( id_transformation, id_step, databaseMeta.getObjectId() );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"TableExistsMeta.Exception.UnableToSaveStepInfo\" )\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    CheckResult cr;\n    String error_message = \"\";\n\n    if ( databaseMeta == null ) {\n      error_message = BaseMessages.getString( PKG, \"TableExistsMeta.CheckResult.InvalidConnection\" );\n      cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta );\n      remarks.add( cr );\n    }\n    if ( Utils.isEmpty( resultfieldname ) ) {\n      error_message = BaseMessages.getString( PKG, \"TableExistsMeta.CheckResult.ResultFieldMissing\" );\n      cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta );","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExistsMeta.java#L179-L215","documentation":"TableExistsMeta.saveRep wraps any exception from persisting step attributes and the step-database relationship (insertStepDatabase) into the repository, appending id_step to the message. The save of this step's configuration failed.","triggerScenarios":"Calling saveRep when saveStepAttribute or rep.insertStepDatabase throws — connection lost mid-save, FK violation because databaseMeta has no valid ObjectId, or write-permission failure on repository tables.","commonSituations":"Saving a transformation whose database connection was never persisted (null ObjectId); repository DB constraint violations; read-only or quota-exceeded repository accounts.","solutions":["Inspect the chained cause for the exact repository write error","Ensure the step's databaseMeta is an existing, persisted connection (valid ObjectId) before saving","Reconnect to the repository and retry saving the transformation","Grant write privileges on R_STEP_ATTRIBUTE / R_STEP_DATABASE to the repository user"],"exampleFix":"// before: unsaved connection\nmeta.setDatabaseMeta(new DatabaseMeta(\"db\", \"POSTGRESQL\", \"Native\", host, db, port, user, pass));\ntransMeta.saveRep(...);\n// after: persist the connection first\nrep.save(meta.getDatabaseMeta(), null); // assign ObjectId\ntransMeta.saveRep(...);","handlingStrategy":"retry","validationCode":"// pre-save checks\nif (meta.getDatabaseMeta() != null && meta.getDatabaseMeta().getObjectId() == null) {\n  rep.save(meta.getDatabaseMeta(), null); // persist connection so insertStepDatabase has an id\n}","typeGuard":null,"tryCatchPattern":"try { meta.saveRep(rep, metaStore, idTrans, idStep); }\ncatch (KettleException e) {\n  logError(\"Save failed: \" + e.getCause());\n  rep.disconnect(); rep.connect(user, pass);\n  meta.saveRep(rep, metaStore, idTrans, idStep); // retry once\n}","preventionTips":["Always persist new database connections before saving steps referencing them","Run saves under accounts with full write access to repository tables","Check chained causes for constraint violations and address schema issues"],"tags":["kettle","repository","persistence","step-metadata"],"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"}