{"record":{"id":"d3da63b22589683f","repo":"pentaho/pentaho-kettle","slug":"scriptmeta-exception-unexpectederrorinreadingstepinfo","errorCode":null,"errorMessage":"ScriptMeta.Exception.UnexpectedErrorInReadingStepInfo","messagePattern":"ScriptMeta\\.Exception\\.UnexpectedErrorInReadingStepInfo","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptMeta.java","lineNumber":387,"sourceCode":"            (int) rep.getStepAttributeInteger( id_step, i, JSSCRIPT_TAG_TYPE ),\n            rep.getStepAttributeString( id_step, i, JSSCRIPT_TAG_NAME ),\n            rep.getStepAttributeString( id_step, i, JSSCRIPT_TAG_SCRIPT ) );\n        }\n      }\n\n      int nrfields = rep.countNrStepAttributes( id_step, \"field_name\" );\n      allocate( nrfields );\n\n      for ( int i = 0; i < nrfields; i++ ) {\n        fieldname[i] = rep.getStepAttributeString( id_step, i, \"field_name\" );\n        rename[i] = rep.getStepAttributeString( id_step, i, \"field_rename\" );\n        type[i] = ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, \"field_type\" ) );\n        length[i] = (int) rep.getStepAttributeInteger( id_step, i, \"field_length\" );\n        precision[i] = (int) rep.getStepAttributeInteger( id_step, i, \"field_precision\" );\n        replace[i] = rep.getStepAttributeBoolean( id_step, i, \"field_replace\" );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"ScriptMeta.Exception.UnexpectedErrorInReadingStepInfo\" ), e );\n    }\n  }\n\n  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] );","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptMeta.java#L369-L405","documentation":"readRep() loads Script step metadata from the repository database via rep.getStepAttribute*. Any repository error while reading the step's attributes is wrapped in KettleException 'ScriptMeta.Exception.UnexpectedErrorInReadingStepInfo'.","triggerScenarios":"Loading a transformation from a Pentaho repository when the R_STEP_ATTRIBUTE rows for the Script step are missing, corrupted, or the repository query throws (connection loss, schema mismatch).","commonSituations":"Repository database upgraded/downgraded between PDI versions; broken DB connection mid-load; partial save left step attributes inconsistent.","solutions":["Check the nested cause for the underlying repository/DB error and fix connectivity or schema issues.","Verify the repository schema version matches your PDI version (repository upgrade wizard).","Re-save or re-create the affected Script step; if corrupt, delete the step attribute rows and re-enter settings.","Restore the transformation from a backup or export it as XML to bypass repository state."],"exampleFix":"// before: mismatched repository schema (no field_type attribute rows)\n// after: run repository upgrade to align schema, then reload the transformation","handlingStrategy":"try-catch","validationCode":"// Verify repository connectivity and schema before loading\nif (!rep.connect(...)) throw new IllegalStateException(\"repository unavailable\");","typeGuard":null,"tryCatchPattern":"try { stepMeta.readRep(rep, metaStore, id_step, databases, metaStore); }\ncatch (KettleException e) { log.error(\"readRep failed: \" + e.getCause(), e);\n  // retry once after reconnect, then fail fast\n}","preventionTips":["Keep repository schema in sync with PDI version","Monitor DB connectivity during batch loads","Back up transformations before repository upgrades","Export critical transformations to XML as fallback"],"tags":["repository","database","pdi","persistence"],"backgroundTag":"database-query-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"}