{"record":{"id":"0efc3fa54444f307","repo":"pentaho/pentaho-kettle","slug":"analyticquerymeta-exception-unabletoloadstepinfofromxml","errorCode":null,"errorMessage":"AnalyticQueryMeta.Exception.UnableToLoadStepInfoFromXML","messagePattern":"AnalyticQueryMeta\\.Exception\\.UnableToLoadStepInfoFromXML","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQueryMeta.java","lineNumber":217,"sourceCode":"      int nrfields = XMLHandler.countNodes( fields, \"field\" );\n\n      allocate( sizegroup, nrfields );\n\n      for ( int i = 0; i < sizegroup; i++ ) {\n        Node fnode = XMLHandler.getSubNodeByNr( groupn, \"field\", i );\n        groupField[i] = XMLHandler.getTagValue( fnode, \"name\" );\n      }\n      for ( int i = 0; i < nrfields; i++ ) {\n        Node fnode = XMLHandler.getSubNodeByNr( fields, \"field\", i );\n        aggregateField[i] = XMLHandler.getTagValue( fnode, \"aggregate\" );\n        subjectField[i] = XMLHandler.getTagValue( fnode, \"subject\" );\n        aggregateType[i] = getType( XMLHandler.getTagValue( fnode, \"type\" ) );\n\n        valueField[i] = Integer.parseInt( XMLHandler.getTagValue( fnode, \"valuefield\" ) );\n      }\n\n    } catch ( Exception e ) {\n      throw new KettleXMLException( BaseMessages.getString(\n        PKG, \"AnalyticQueryMeta.Exception.UnableToLoadStepInfoFromXML\" ), e );\n    }\n  }\n\n  public static final int getType( String desc ) {\n    for ( int i = 0; i < typeGroupCode.length; i++ ) {\n      if ( typeGroupCode[i].equalsIgnoreCase( desc ) ) {\n        return i;\n      }\n    }\n    for ( int i = 0; i < typeGroupLongDesc.length; i++ ) {\n      if ( typeGroupLongDesc[i].equalsIgnoreCase( desc ) ) {\n        return i;\n      }\n    }\n    return 0;\n  }\n","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQueryMeta.java#L199-L235","documentation":"KettleXMLException thrown by AnalyticQueryMeta.readData() when parsing the <fields>/<field> XML for an Analytic Query step in a .ktr fails. Typical causes are NumberFormatException from Integer.parseInt on a non-numeric 'valuefield' attribute or any other malformed/unexpected XML. It wraps the original exception, so the root cause is in the chained cause.","triggerScenarios":"loadXML() -> readData() encounters XML where the 'valuefield' tag value is not a parseable integer, a required tag ('type', 'valuefield') is missing/empty, or the XML structure under <fields> does not match what getTagValue/NodeFilter expects.","commonSituations":"Hand-edited or truncated .ktr files; transformations written by a different Pentaho/Kettle version with a changed step XML schema; copying steps between files with partial XML; corruption from external merge tools.","solutions":["Inspect the wrapped cause (e.getCause()) — usually NumberFormatException — and fix the offending 'valuefield' value in the .ktr XML to an integer","Open and re-save the Analytic Query step in Spoon so the XML is regenerated from the current schema","Verify the transformation file was produced by a compatible Pentaho/Kettle version and re-export if versions differ","Restore the .ktr from version control or backup if it was hand-edited or truncated"],"exampleFix":"// before (malformed XML)\n<valuefield>abc</valuefield>\n// after\n<valuefield>1</valuefield>","handlingStrategy":"try-catch","validationCode":"// Validate the Analytic Query XML fragment before loading\nNode fnode = XMLHandler.getSubNode(stepNode, \"fields\");\nfor (Node f : eachChild(fnode)) {\n  String vf = XMLHandler.getTagValue(f, \"valuefield\");\n  Integer.parseInt(vf); // throws NumberFormatException early with clear context\n}","typeGuard":"boolean isParseableInt(String s) { try { Integer.parseInt(s); return true; } catch (NumberFormatException e) { return false; } }","tryCatchPattern":"try {\n  transMeta.loadXML(xmlInputStream, null, metaStore);\n} catch (KettleXMLException e) {\n  log.error(\"Bad Analytic Query XML: \" + e.getMessage(), e.getCause());\n  // abort load or fall back to a known-good file\n}","preventionTips":["Never hand-edit .ktr XML; edit via Spoon","Validate .ktr files in CI by loading them with TransMeta before deploy","Keep producer and consumer Pentaho/Kettle versions aligned","Keep transformations under version control to recover from corruption"],"tags":["xml","parsing","serialization","kettle"],"backgroundTag":"xml-parse-error","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"}