{"record":{"id":"84f15edeecc9fa6f","repo":"pentaho/pentaho-kettle","slug":"addsequencemeta-exception-unabletosavestepinfo","errorCode":null,"errorMessage":"AddSequenceMeta.Exception.UnableToSaveStepInfo","messagePattern":"AddSequenceMeta\\.Exception\\.UnableToSaveStepInfo","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/addsequence/AddSequenceMeta.java","lineNumber":362,"sourceCode":"      rep.saveStepAttribute( id_transformation, id_step, \"use_database\", useDatabase );\n\n      rep.saveDatabaseMetaStepAttribute( id_transformation, id_step, \"id_connection\", database );\n\n      rep.saveStepAttribute( id_transformation, id_step, \"schema\", schemaName );\n      rep.saveStepAttribute( id_transformation, id_step, \"seqname\", sequenceName );\n\n      rep.saveStepAttribute( id_transformation, id_step, \"use_counter\", useCounter );\n      rep.saveStepAttribute( id_transformation, id_step, \"counter_name\", counterName );\n      rep.saveStepAttribute( id_transformation, id_step, \"start_at\", startAt );\n      rep.saveStepAttribute( id_transformation, id_step, \"increment_by\", incrementBy );\n      rep.saveStepAttribute( id_transformation, id_step, \"max_value\", maxValue );\n\n      // Also, save the step-database relationship!\n      if ( database != null ) {\n        rep.insertStepDatabase( id_transformation, id_step, database.getObjectId() );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"AddSequenceMeta.Exception.UnableToSaveStepInfo\" )\n        + id_step, e );\n    }\n  }\n\n  @Override\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    if ( useDatabase ) {\n      Database db = new Database( loggingObject, database );\n      db.shareVariablesWith( transMeta );\n      try {\n        db.connect();\n        if ( db.checkSequenceExists( transMeta.environmentSubstitute( schemaName ), transMeta\n          .environmentSubstitute( sequenceName ) ) ) {\n          cr =\n            new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/addsequence/AddSequenceMeta.java#L344-L380","documentation":"AddSequenceMeta.saveRep() persists the step's settings to the repository; any Exception during attribute insertion or the insertStepDatabase call is wrapped in a KettleException with this message plus the step id. It means the step metadata could not be saved, so the transformation may be saved incompletely in the repository.","triggerScenarios":"saveRep(rep, metaStore, id_transformation, id_step) throws while calling rep.saveStepAttribute(...) for sequence fields or rep.insertStepDatabase(...) when a database is linked — repository connection loss, constraint violations, read-only repository, or null/oversized attribute values.","commonSituations":"Repository database down or network dropped mid-save; user lacks INSERT permission on repository tables; referencing a database connection object not yet saved (null/unsaved ObjectId) so insertStepDatabase fails; repository size/quota limits.","solutions":["Check repository database availability and connection settings; retry the save once connectivity is restored","Verify the repository user has INSERT/UPDATE permissions on r_step_attribute and related tables","Ensure the step's referenced database connection is saved and has a valid ObjectId before saving the step","Review the wrapped cause 'e' for the specific SQL failure (constraint, lock, quota) and fix accordingly"],"exampleFix":"// before: saving step referencing an unsaved database meta\nstepMeta.getDatabaseMeta().setObjectId(null);\nrep.saveStep(...);\n// after: persist the database connection first, then the step\nRepositoryObject db = rep.saveDatabaseMeta(jobMeta.getDatabaseMeta());\nstepMeta.getDatabaseMeta().setObjectId(db.getObjectId());\nrep.saveStep(...);","handlingStrategy":"try-catch","validationCode":"if (rep == null || id_step == null) throw new IllegalStateException(\"Repository and step id must be resolved before saving\");\nif (meta.getDatabase() != null && meta.getDatabase().getObjectId() == null)\n  throw new IllegalStateException(\"Linked database connection is not saved; save it before the step\");","typeGuard":"boolean readyToSave(AddSequenceMeta m) {\n  return m != null && (m.getDatabase() == null || m.getDatabase().getObjectId() != null);\n}","tryCatchPattern":"try {\n  meta.saveRep(rep, metaStore, idTransformation, idStep);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"UnableToSaveStepInfo\")) {\n    logError(\"Repository save failed for step id \" + id_step + \": \" + e.getCause());\n    // check DB connectivity/permissions, then retry\n  } else throw e;\n}","preventionTips":["Ensure the referenced database connection is saved (has an ObjectId) before saving the step","Confirm the repository user has INSERT/UPDATE rights on step attribute tables","Retry saves after transient network failures; verify with a re-read","Keep the repository database backed up and monitor for quota/lock issues"],"tags":["kettle","pentaho","repository","database-write","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"}