pentaho/pentaho-kettle · error · KettleException

ScriptMeta.Exception.UnexpectedErrorInReadingStepInfo

Error message

ScriptMeta.Exception.UnexpectedErrorInReadingStepInfo

What it means

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'.

Solutions

  1. Check the nested cause for the underlying repository/DB error and fix connectivity or schema issues.
  2. Verify the repository schema version matches your PDI version (repository upgrade wizard).
  3. Re-save or re-create the affected Script step; if corrupt, delete the step attribute rows and re-enter settings.
  4. Restore the transformation from a backup or export it as XML to bypass repository state.

Example fix

// before: mismatched repository schema (no field_type attribute rows)
// after: run repository upgrade to align schema, then reload the transformation
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify repository connectivity and schema before loading
if (!rep.connect(...)) throw new IllegalStateException("repository unavailable");

Try / catch

try { stepMeta.readRep(rep, metaStore, id_step, databases, metaStore); }
catch (KettleException e) { log.error("readRep failed: " + e.getCause(), e);
  // retry once after reconnect, then fail fast
}

Prevention

When it happens

Trigger: 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).

Common situations: Repository database upgraded/downgraded between PDI versions; broken DB connection mid-load; partial save left step attributes inconsistent.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/d3da63b22589683f. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptMeta.java:387

            (int) rep.getStepAttributeInteger( id_step, i, JSSCRIPT_TAG_TYPE ),
            rep.getStepAttributeString( id_step, i, JSSCRIPT_TAG_NAME ),
            rep.getStepAttributeString( id_step, i, JSSCRIPT_TAG_SCRIPT ) );
        }
      }

      int nrfields = rep.countNrStepAttributes( id_step, "field_name" );
      allocate( nrfields );

      for ( int i = 0; i < nrfields; i++ ) {
        fieldname[i] = rep.getStepAttributeString( id_step, i, "field_name" );
        rename[i] = rep.getStepAttributeString( id_step, i, "field_rename" );
        type[i] = ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, "field_type" ) );
        length[i] = (int) rep.getStepAttributeInteger( id_step, i, "field_length" );
        precision[i] = (int) rep.getStepAttributeInteger( id_step, i, "field_precision" );
        replace[i] = rep.getStepAttributeBoolean( id_step, i, "field_replace" );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "ScriptMeta.Exception.UnexpectedErrorInReadingStepInfo" ), e );
    }
  }

  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {
    try {
      for ( int i = 0; i < jsScripts.length; i++ ) {
        rep.saveStepAttribute( id_transformation, id_step, i, JSSCRIPT_TAG_NAME, jsScripts[i].getScriptName() );
        rep.saveStepAttribute( id_transformation, id_step, i, JSSCRIPT_TAG_SCRIPT, jsScripts[i].getScript() );
        rep.saveStepAttribute( id_transformation, id_step, i, JSSCRIPT_TAG_TYPE, jsScripts[i].getScriptType() );
      }

      for ( int i = 0; i < fieldname.length; i++ ) {
        rep.saveStepAttribute( id_transformation, id_step, i, "field_name", fieldname[i] );
        rep.saveStepAttribute( id_transformation, id_step, i, "field_rename", rename[i] );
        rep.saveStepAttribute( id_transformation, id_step, i, "field_type",
          ValueMetaFactory.getValueMetaName( type[i] ) );
        rep.saveStepAttribute( id_transformation, id_step, i, "field_length", length[i] );

View on GitHub (pinned to f3058517a1)