{"record":{"id":"d0ec4af9a2d04d12","repo":"pentaho/pentaho-kettle","slug":"unable-to-save-step-information-to-the-repository-for-id-d0ec4a","errorCode":null,"errorMessage":"Unable to save step information to the repository for id_step=\" + id_step","messagePattern":"Unable to save step information to the repository for id_step=\" \\+ id_step","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/randomvalue/RandomValueMeta.java","lineNumber":285,"sourceCode":"      for ( int i = 0; i < nrfields; i++ ) {\n        fieldName[i] = rep.getStepAttributeString( id_step, i, \"field_name\" );\n        fieldType[i] = getType( rep.getStepAttributeString( id_step, i, \"field_type\" ) );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unexpected error reading step information from the repository\", e );\n    }\n  }\n\n  @Override\n  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {\n    try {\n      for ( int i = 0; i < fieldName.length; i++ ) {\n        rep.saveStepAttribute( id_transformation, id_step, i, \"field_name\", fieldName[i] );\n        rep.saveStepAttribute( id_transformation, id_step, i, \"field_type\", functions[fieldType[i]] != null\n          ? functions[fieldType[i]].getCode() : \"\" );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to save step information to the repository for id_step=\" + id_step, e );\n    }\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    // See if we have input streams leading to this step!\n    int nrRemarks = remarks.size();\n    for ( int i = 0; i < fieldName.length; i++ ) {\n      if ( fieldType[i] <= TYPE_RANDOM_NONE ) {\n        CheckResult cr =\n          new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString(\n            PKG, \"RandomValueMeta.CheckResult.FieldHasNoType\", fieldName[i] ), stepMeta );\n        remarks.add( cr );\n      }\n    }","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/randomvalue/RandomValueMeta.java#L267-L303","documentation":"RandomValueMeta.saveRep wraps exceptions raised while persisting the step's field list (field_name / field_type per row index) to the repository into a KettleException. The step configuration could not be saved; the cause is chained.","triggerScenarios":"saveRep() called during transformation save when Repository.saveStepAttribute throws — DB connection failure, read-only repository, constraint violation on r_step_attribute, or fieldType index out of bounds when reading functions[fieldType[i]].","commonSituations":"Saving over a flaky VPN database connection; repository account without write privileges; metadata migrated between Pentaho versions where the fieldType enum index no longer matches functions[].","solutions":["Inspect the chained cause for the real repository error","Validate fieldType values are in range before saving (functions[fieldType[i]] must exist)","Reconnect to the repository and retry the save","Check repository user write privileges on r_step_attribute"],"exampleFix":"// before\nmeta.saveRep(repository, metastore, transId, stepId);\n// after\nif (meta.getFieldType() != null) {\n  for (int t : meta.getFieldType()) {\n    if (t < 0 || t >= RandomValueMeta.functions.length) {\n      throw new KettleException(\"Invalid fieldType index: \" + t);\n    }\n  }\n}\nmeta.saveRep(repository, metastore, transId, stepId);","handlingStrategy":"validation","validationCode":"if (meta.getFieldType() != null) {\n  for (int t : meta.getFieldType()) {\n    if (t < 0 || t >= RandomValueMeta.functions.length) throw new KettleException(\"fieldType index out of range: \" + t);\n  }\n}","typeGuard":null,"tryCatchPattern":"try { meta.saveRep(rep, metaStore, transId, stepId); } catch (KettleException e) { logError(\"RandomValue repository save failed: \" + e.getCause()); throw e; }","preventionTips":["Validate fieldType enum indexes against functions[] before saving","Ensure repository write permissions for the save user","Reconnect to the repository before long save sessions","Compare function code lists across Pentaho versions when migrating"],"tags":["kettle","repository","metadata","serialization"],"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"}