{"record":{"id":"4592355d50cae65d","repo":"pentaho/pentaho-kettle","slug":"mappinginputmeta-exception-unexpectederrorinreadingstepinfo","errorCode":"MappingInputMeta.Exception.UnexpectedErrorInReadingStepInfo","errorMessage":"MappingInputMeta.Exception.UnexpectedErrorInReadingStepInfo","messagePattern":"MappingInputMeta\\.Exception\\.UnexpectedErrorInReadingStepInfo","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta.java","lineNumber":353,"sourceCode":"  }\n\n  public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases )\n    throws KettleException {\n    try {\n      int nrfields = rep.countNrStepAttributes( id_step, \"field_name\" );\n\n      allocate( nrfields );\n\n      for ( int i = 0; i < nrfields; i++ ) {\n        fieldName[ i ] = rep.getStepAttributeString( id_step, i, \"field_name\" );\n        fieldType[ i ] = ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, \"field_type\" ) );\n        fieldLength[ i ] = (int) rep.getStepAttributeInteger( id_step, i, \"field_length\" );\n        fieldPrecision[ i ] = (int) rep.getStepAttributeInteger( id_step, i, \"field_precision\" );\n      }\n\n      selectingAndSortingUnspecifiedFields = rep.getStepAttributeBoolean( id_step, \"select_unspecified\" );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"MappingInputMeta.Exception.UnexpectedErrorInReadingStepInfo\" ), e );\n    }\n  }\n\n  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step )\n    throws KettleException {\n    try {\n      for ( int i = 0; i < fieldName.length; i++ ) {\n        if ( fieldName[ i ] != null && fieldName[ i ].length() != 0 ) {\n          rep.saveStepAttribute( id_transformation, id_step, i, \"field_name\", fieldName[ i ] );\n          rep.saveStepAttribute( id_transformation, id_step, i, \"field_type\",\n            ValueMetaFactory.getValueMetaName( fieldType[ i ] ) );\n          rep.saveStepAttribute( id_transformation, id_step, i, \"field_length\", fieldLength[ i ] );\n          rep.saveStepAttribute( id_transformation, id_step, i, \"field_precision\", fieldPrecision[ i ] );\n        }\n      }\n\n      rep.saveStepAttribute(","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta.java#L335-L371","documentation":"MappingInputMeta.readRep() wraps any exception thrown while reading the Mapping Input step's attributes (field names, types, lengths, precisions, select_unspecified flag) from the Kettle repository into a KettleException with this message key. It signals that the stored step definition could not be loaded, typically due to repository connectivity issues or corrupt/missing metadata. The original exception is chained as the cause.","triggerScenarios":"Calling readRep() on a MappingInputMeta when Repository.getStepAttributeInteger/getStepAttributeBoolean throws — e.g. repository connection dropped mid-read, id_step points to a deleted/nonexistent step row, or a stored attribute has an unexpected value that fails conversion.","commonSituations":"Opening a transformation from a repository where the step metadata was manually edited or corrupted; stale repository connections after a database restart; reading transformations created in a much older Pentaho version with incompatible stored attributes; permission problems on the repository database.","solutions":["Verify the repository connection is alive and re-connect, then retry loading the transformation.","Check the chained cause exception for the underlying repository/database error and fix it (permissions, missing rows, network).","Confirm id_step refers to an existing step in R_STEP_ATTRIBUTE; if the step row is corrupt, re-create the step in Spoon and re-save the transformation.","If caused by a version mismatch, upgrade/repair the repository tables and re-export the transformation."],"exampleFix":"// before: loading directly, connection may be stale\nmeta.readRep(repository, metastore, transObjectId, stepObjectId);\n\n// after: ensure a live repository first\nif (repository == null || !repository.isConnected()) {\n  repository.connect(user, password);\n}\ntry {\n  meta.readRep(repository, metastore, transObjectId, stepObjectId);\n} catch (KettleException e) {\n  logError(\"Failed to read MappingInput step metadata: \" + e.getCause(), e);\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (repository == null || !repository.isConnected()) {\n  repository.connect(user, password);\n}\n// confirm the step exists before readRep\nif (repository.getStepAttributeCount(id_step) <= 0) {\n  throw new IllegalStateException(\"Step attributes missing for id_step=\" + id_step);\n}","typeGuard":"boolean isReadable(Repository rep, ObjectId idStep) {\n  return rep != null && rep.isConnected() && idStep != null;\n}","tryCatchPattern":"try {\n  meta.readRep(repository, metastore, transObjectId, stepObjectId);\n} catch (KettleException e) {\n  logError(\"MappingInput metadata read failed: \" + e.getCause(), e);\n  throw new RuntimeException(\"Repository read failed; check connection and step metadata\", e);\n}","preventionTips":["Validate repository connectivity before loading transformations.","Never edit R_STEP_ATTRIBUTE rows directly in the database.","Keep Pentaho client and repository schema versions aligned.","Log e.getCause() to surface the real database error."],"tags":["kettle","repository","step-metadata","persistence"],"backgroundTag":"file-read-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"}