{"record":{"id":"c781edfbff880e52","repo":"pentaho/pentaho-kettle","slug":"analyticquerymeta-exception","errorCode":null,"errorMessage":"AnalyticQueryMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository","messagePattern":"AnalyticQueryMeta\\.Exception\\.UnexpectedErrorInReadingStepInfoFromRepository","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQueryMeta.java","lineNumber":343,"sourceCode":"\n      int groupsize = rep.countNrStepAttributes( id_step, \"group_name\" );\n      int nrvalues = rep.countNrStepAttributes( id_step, \"aggregate_name\" );\n\n      allocate( groupsize, nrvalues );\n\n      for ( int i = 0; i < groupsize; i++ ) {\n        groupField[i] = rep.getStepAttributeString( id_step, i, \"group_name\" );\n      }\n\n      for ( int i = 0; i < nrvalues; i++ ) {\n        aggregateField[i] = rep.getStepAttributeString( id_step, i, \"aggregate_name\" );\n        subjectField[i] = rep.getStepAttributeString( id_step, i, \"aggregate_subject\" );\n        aggregateType[i] = getType( rep.getStepAttributeString( id_step, i, \"aggregate_type\" ) );\n        valueField[i] = (int) rep.getStepAttributeInteger( id_step, i, \"aggregate_value_field\" );\n      }\n\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"AnalyticQueryMeta.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\n      for ( int i = 0; i < groupField.length; i++ ) {\n        rep.saveStepAttribute( id_transformation, id_step, i, \"group_name\", groupField[i] );\n      }\n\n      for ( int i = 0; i < subjectField.length; i++ ) {\n        rep.saveStepAttribute( id_transformation, id_step, i, \"aggregate_name\", aggregateField[i] );\n        rep.saveStepAttribute( id_transformation, id_step, i, \"aggregate_subject\", subjectField[i] );\n        rep.saveStepAttribute( id_transformation, id_step, i, \"aggregate_type\", getTypeDesc( aggregateType[i] ) );\n        rep.saveStepAttribute( id_transformation, id_step, i, \"aggregate_value_field\", valueField[i] );\n      }\n    } catch ( Exception e ) {","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQueryMeta.java#L325-L361","documentation":"Generic KettleException thrown by AnalyticQueryMeta.readRep() when any exception occurs while loading the Analytic Query step's attributes from a repository (per-aggregate 'aggregate_name', 'aggregate_subject', 'aggregate_type', 'aggregate_value_field' attributes). It is a catch-all wrapper: the real problem is the chained cause.","triggerScenarios":"loadXML counterpart for the repository: rep.getStepAttributeString/getStepAttributeInteger calls throw (repository connection failure, missing id_step record, invalid stored attribute values) while looping over aggregates.","commonSituations":"Repository database down or connection dropped mid-load; step metadata rows deleted or partially migrated in KETTLE_STEP_ATTRIBUTES; loading a transformation saved by a different Kettle version with different attribute names.","solutions":["Check the chained cause and the repository's connectivity (database up, credentials valid, network reachable)","Verify the step's attribute rows exist in the repository tables (KETTLE_STEP_ATTRIBUTE for the given id_step)","Open and re-save the step in Spoon against the same repository to rewrite its attributes","Migrate/re-export the transformation if it was saved with an incompatible Kettle version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-flight repository access before loading the transformation\nRepository rep = connectToRepository();\nif (!rep.isConnected()) { throw new IllegalStateException(\"Repository unreachable\"); }\n// Optionally verify the step attribute rows exist for the expected id_step","typeGuard":null,"tryCatchPattern":"try {\n  transMeta.loadTransformation(rep, transObjectId, metaStore, true, null);\n} catch (KettleException e) {\n  log.error(\"Repository read failed: \" + e.getMessage(), e.getCause());\n  // check cause: connectivity vs missing attributes, then retry or fail over to file-based .ktr\n}","preventionTips":["Monitor repository database health before running repository-based jobs","Pin a compatible Kettle version for saving and loading from the same repository","Back up repository tables before migrations","Keep a file-based (.ktr) export as a fallback source of the transformation"],"tags":["repository","database","serialization","kettle"],"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"}