{"record":{"id":"65eccc19297f1202","repo":"pentaho/pentaho-kettle","slug":"switchcasemeta-exception","errorCode":"SwitchCaseMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository","errorMessage":"SwitchCaseMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository","messagePattern":"SwitchCaseMeta\\.Exception\\.UnexpectedErrorInReadingStepInfoFromRepository","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCaseMeta.java","lineNumber":207,"sourceCode":"      fieldname = rep.getStepAttributeString( id_step, \"fieldname\" );\n      isContains = rep.getStepAttributeBoolean( id_step, \"use_contains\" );\n      caseValueType = ValueMetaBase.getType( rep.getStepAttributeString( id_step, \"case_value_type\" ) );\n      caseValueFormat = rep.getStepAttributeString( id_step, \"case_value_format\" );\n      caseValueDecimal = rep.getStepAttributeString( id_step, \"case_value_decimal\" );\n      caseValueGroup = rep.getStepAttributeString( id_step, \"case_value_group\" );\n\n      defaultTargetStepname = rep.getStepAttributeString( id_step, \"default_target_step\" );\n\n      int nrCases = rep.countNrStepAttributes( id_step, \"case_value\" );\n      allocate();\n      for ( int i = 0; i < nrCases; i++ ) {\n        SwitchCaseTarget target = new SwitchCaseTarget();\n        target.caseValue = rep.getStepAttributeString( id_step, i, \"case_value\" );\n        target.caseTargetStepname = rep.getStepAttributeString( id_step, i, \"case_target_step\" );\n        caseTargets.add( target );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"SwitchCaseMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository\" ), e );\n    }\n  }\n\n  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {\n    try {\n      rep.saveStepAttribute( id_transformation, id_step, \"fieldname\", fieldname );\n      rep.saveStepAttribute( id_transformation, id_step, \"use_contains\", isContains );\n      rep.saveStepAttribute( id_transformation, id_step, \"case_value_type\", ValueMetaBase.getTypeDesc( caseValueType ) );\n      rep.saveStepAttribute( id_transformation, id_step, \"case_value_format\", caseValueFormat );\n      rep.saveStepAttribute( id_transformation, id_step, \"case_value_decimal\", caseValueDecimal );\n      rep.saveStepAttribute( id_transformation, id_step, \"case_value_group\", caseValueGroup );\n\n      rep.saveStepAttribute( id_transformation, id_step, \"default_target_step\",\n        defaultTargetStep != null ? defaultTargetStep.getName() : defaultTargetStepname\n      );\n\n      for ( int i = 0; i < caseTargets.size(); i++ ) {","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCaseMeta.java#L189-L225","documentation":"KettleException thrown by SwitchCaseMeta.readRep when an unexpected exception occurs while reading the Switch/Case step's configuration from a Pentaho repository — including the fieldname, contains/startswith flags, and per-case attributes (case_value, case_target_step). Any repository failure inside the try block is wrapped with this localized message and rethrown; the root cause is in the chained exception.","triggerScenarios":"Loading the transformation from a repository when rep.getStepAttributeString fails (connection loss, corrupt attributes), or the count/structure of stored case entries mismatches what readRep iterates (e.g., missing nr attribute rows from a partial save).","commonSituations":"Repository database corruption or interrupted save leaving partial r_step_attribute rows; version mismatch between client and repository metadata; permission or network issues during load.","solutions":["Inspect the chained cause exception for the underlying repository error.","Verify repository connectivity and re-login, then retry loading the transformation.","Repair the step by re-creating the Switch/Case step and re-entering its mappings, then re-save.","Check for interrupted/partial saves in the repository database and clean up orphaned attribute rows."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if ( repository == null || !repository.isConnected() ) throw new IllegalStateException( \"Repository not connected\" );","typeGuard":null,"tryCatchPattern":"try { meta.readRep( rep, metaStore, idStep, dbs ); } catch ( KettleException e ) { log.error( \"Switch/Case readRep failed: \" + e.getCause(), e ); throw e; }","preventionTips":["Ensure clean repository saves (avoid killing Spoon mid-save).","Monitor repository DB health.","Keep client/server metadata versions aligned.","Back up the repository before migrations."],"tags":["kettle","repository","metadata-load","pdi"],"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"}