{"record":{"id":"7faccd49a2d94ca0","repo":"pentaho/pentaho-kettle","slug":"scriptmeta-exception-unabletosavestepinfo","errorCode":null,"errorMessage":"ScriptMeta.Exception.UnableToSaveStepInfo","messagePattern":"ScriptMeta\\.Exception\\.UnableToSaveStepInfo","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptMeta.java","lineNumber":410,"sourceCode":"  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {\n    try {\n      for ( int i = 0; i < jsScripts.length; i++ ) {\n        rep.saveStepAttribute( id_transformation, id_step, i, JSSCRIPT_TAG_NAME, jsScripts[i].getScriptName() );\n        rep.saveStepAttribute( id_transformation, id_step, i, JSSCRIPT_TAG_SCRIPT, jsScripts[i].getScript() );\n        rep.saveStepAttribute( id_transformation, id_step, i, JSSCRIPT_TAG_TYPE, jsScripts[i].getScriptType() );\n      }\n\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_rename\", rename[i] );\n        rep.saveStepAttribute( id_transformation, id_step, i, \"field_type\",\n          ValueMetaFactory.getValueMetaName( type[i] ) );\n        rep.saveStepAttribute( id_transformation, id_step, i, \"field_length\", length[i] );\n        rep.saveStepAttribute( id_transformation, id_step, i, \"field_precision\", precision[i] );\n        rep.saveStepAttribute( id_transformation, id_step, i, \"field_replace\", replace[i] );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"ScriptMeta.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    boolean error_found = false;\n    String error_message = \"\";\n    CheckResult cr;\n\n    ScriptEngine jscx;\n    Bindings jsscope;\n    CompiledScript jsscript;\n\n    jscx = createNewScriptEngine( stepMeta.getName() );\n    jsscope = jscx.getBindings( ScriptContext.ENGINE_SCOPE );\n","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptMeta.java#L392-L428","documentation":"saveRep() persists Script step metadata (scripts, fields, types, lengths, precision, replace flags) as step attributes. Any repository exception during save is wrapped in KettleException 'UnableToSaveStepInfo' plus the step's ObjectId.","triggerScenarios":"Saving a transformation to the repository when writing R_STEP_ATTRIBUTE rows fails — DB connection dropped, constraint violation, read-only database, or oversized attribute values.","commonSituations":"Repository database disk full or read-only; network hiccup mid-save; concurrent modification of the same transformation by two users.","solutions":["Read the nested cause (Caused by) to identify the database-level failure.","Reconnect/retry the save after restoring repository database connectivity.","Check repository user permissions — the account needs write access to step attributes.","Save the transformation as XML locally as a workaround while fixing the repository."],"exampleFix":"// before: saving while DB is read-only\nrep.saveStepAttribute(id_transformation, id_step, i, \"field_replace\", replace[i]);\n// after: ensure a writable connection first\nif (!rep.getConnection().isReadOnly()) { rep.saveStepAttribute(...); }","handlingStrategy":"retry","validationCode":"// Check writability before saving\nif (rep.getConnection().isReadOnly()) throw new IllegalStateException(\"repository read-only\");","typeGuard":null,"tryCatchPattern":"try { saveTransformation(); } catch (KettleException e) {\n  if (e.getCause() instanceof java.sql.SQLException) { reconnectAndRetryOnce(); }\n  else { exportToXmlLocally(); throw e; }\n}","preventionTips":["Ensure repository DB disk space and write permissions","Avoid two users saving the same transformation simultaneously","Save to XML locally before large edits","Check 'Caused by' for SQL error codes"],"tags":["repository","database","pdi","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"}