{"record":{"id":"d9523d6ce7c3ea04","repo":"pentaho/pentaho-kettle","slug":"unable-to-save-step-information-to-the-repository-for-stepid","errorCode":null,"errorMessage":"Unable to save step information to the repository for stepId=<stepId>","messagePattern":"Unable to save step information to the repository for stepId=<stepId>","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/AvroOutputMetaBase.java","lineNumber":297,"sourceCode":"        rep.saveStepAttribute( transformationId, stepId, i, \"name\", field.getPentahoFieldName() );\n        rep.saveStepAttribute( transformationId, stepId, i, \"type\", field.getAvroType().getId() );\n        rep.saveStepAttribute( transformationId, stepId, i, PRECISION, field.getPrecision() );\n        rep.saveStepAttribute( transformationId, stepId, i, SCALE, field.getScale() );\n        rep.saveStepAttribute( transformationId, stepId, i, NULLABLE, Boolean.toString( field.getAllowNull() ) );\n        rep.saveStepAttribute( transformationId, stepId, i, DEFAULT, field.getDefaultValue() );\n      }\n      super.saveRep( rep, metaStore, transformationId, stepId );\n      rep.saveStepAttribute( transformationId, stepId, FieldNames.COMPRESSION, compressionType );\n      rep.saveStepAttribute( transformationId, stepId, FieldNames.DATE_FORMAT, dateTimeFormat );\n      rep.saveStepAttribute( transformationId, stepId, FieldNames.DATE_IN_FILE_NAME, dateInFileName );\n      rep.saveStepAttribute( transformationId, stepId, FieldNames.TIME_IN_FILE_NAME, timeInFileName );\n      rep.saveStepAttribute( transformationId, stepId, FieldNames.SCHEMA_FILENAME, schemaFilename );\n      rep.saveStepAttribute( transformationId, stepId, FieldNames.NAMESPACE, namespace );\n      rep.saveStepAttribute( transformationId, stepId, FieldNames.DOC_VALUE, docValue );\n      rep.saveStepAttribute( transformationId, stepId, FieldNames.RECORD_NAME, recordName );\n\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to save step information to the repository for stepId=\" + stepId, e );\n    }\n  }\n\n  public String getSchemaFilename() {\n    return schemaFilename;\n  }\n\n  public void setSchemaFilename( String schemaFilename ) {\n    this.schemaFilename = schemaFilename;\n  }\n\n  public String getNamespace() {\n    return namespace;\n  }\n\n  public void setNamespace( String namespace ) {\n    this.namespace = namespace;\n  }","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/AvroOutputMetaBase.java#L279-L315","documentation":"KettleException thrown by AvroOutputMetaBase.saveRep when any repository step-attribute save fails while persisting the Avro output step's metadata (schema filename, namespace, doc, record name). It wraps the underlying exception (typically a repository connectivity or schema issue) with the stepId for context.","triggerScenarios":"Calling saveRep during transformation save against a repository (database or file) when saveStepAttribute throws — e.g. repository connection dropped mid-save, schema/table missing or locked, or invalid transformationId/stepId.","commonSituations":"Network interruption between Pentaho and the repository database; saving a transformation after the repository metadata tables were altered/upgraded incorrectly; concurrent edits locking the step row; using a transformation loaded from XML but trying to save to a repository where the step id is stale.","solutions":["Check repository connectivity (ping/reconnect the repository database) and retry the save","Verify the repository metadata tables (r_step_attribute) exist, are writable, and match the Pentaho version schema","Confirm the transformationId/stepId are valid for the connected repository; re-open and re-save the transformation","Inspect the wrapped cause exception (getCause()) for the true failure (SQL error, timeout, permissions)","As a workaround, save the transformation as XML (ktr file) instead of to the repository"],"exampleFix":"// before: opaque wrap only\nthrow new KettleException( \"Unable to save step information to the repository for stepId=\" + stepId, e );\n// after: expose cause class to speed diagnosis\nKettleException ke = new KettleException( \"Unable to save step information to the repository for stepId=\" + stepId, e );\nke.addSuppressed( e ); throw ke; // inspect e (SQL/DB) on caller side, e.g. reconnect on transient errors","handlingStrategy":"try-catch","validationCode":"// verify repository health before save\nif ( repository == null || !repository.isConnected() ) { throw new IllegalStateException( \"Repository not connected\" ); }\nrepository.connect( username, password ); // ensure a live session first","typeGuard":"boolean canSave = repository != null && repository.isConnected() && transformationId != null && stepId >= 0;","tryCatchPattern":"try { avroOutputMeta.saveRep( transMeta, repository, transformationId, stepId ); }\ncatch ( KettleException e ) {\n  logError( \"Repository save failed for stepId=\" + stepId + \", cause=\" + e.getCause(), e );\n  if ( e.getCause() instanceof java.sql.SQLException && isTransient( (java.sql.SQLException) e.getCause() ) ) { repository.disconnect(); repository.connect(); retrySave(); }\n  else { throw new KettleException( \"Non-retryable repository save failure\", e ); }\n}","preventionTips":["Reconnect the repository before long editing sessions and before saving","Keep repository metadata tables upgraded to match the Pentaho version","Avoid concurrent edits of the same transformation by multiple users","Log the cause chain, not just the message, when a save fails"],"tags":["repository","persistence","kettle","database"],"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"}