{"record":{"id":"0d0c5e54719c1646","repo":"pentaho/pentaho-kettle","slug":"memorygroupbymeta-exception-unabletoloadstepinfofromxml","errorCode":"MemoryGroupByMeta.Exception.UnableToLoadStepInfoFromXML","errorMessage":"MemoryGroupByMeta.Exception.UnableToLoadStepInfoFromXML","messagePattern":"MemoryGroupByMeta\\.Exception\\.UnableToLoadStepInfoFromXML","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMeta.java","lineNumber":286,"sourceCode":"        subjectField[i] = XMLHandler.getTagValue( fnode, \"subject\" );\n        aggregateType[i] = getType( XMLHandler.getTagValue( fnode, \"type\" ) );\n\n        if ( aggregateType[i] == TYPE_GROUP_COUNT_ALL\n          || aggregateType[i] == TYPE_GROUP_COUNT_DISTINCT || aggregateType[i] == TYPE_GROUP_COUNT_ANY ) {\n          hasNumberOfValues = true;\n        }\n\n        valueField[i] = XMLHandler.getTagValue( fnode, \"valuefield\" );\n      }\n\n      String giveBackRow = XMLHandler.getTagValue( stepnode, \"give_back_row\" );\n      if ( Utils.isEmpty( giveBackRow ) ) {\n        alwaysGivingBackOneRow = hasNumberOfValues;\n      } else {\n        alwaysGivingBackOneRow = \"Y\".equalsIgnoreCase( giveBackRow );\n      }\n    } catch ( Exception e ) {\n      throw new KettleXMLException( BaseMessages.getString(\n        PKG, \"MemoryGroupByMeta.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":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMeta.java#L268-L304","documentation":"MemoryGroupByMeta.readData() (invoked via loadXML) parses the MemoryGroupBy step's definition from a transformation XML node — grouping fields, aggregation fields/types, and the give_back_row flag. Any exception during this parsing is wrapped in a KettleXMLException with this message key, meaning the step could not be reconstructed from the XML. The original parse/conversion error is chained as the cause.","triggerScenarios":"Loading a .ktr whose <step> node for MemoryGroupBy contains malformed or unexpected XML — missing required child elements, non-numeric values where ints are expected (e.g. number_of_values), or a structurally corrupt XML file.","commonSituations":"Hand-edited or truncated .ktr files; transformations produced by newer/older Pentaho versions with changed XML schema; version-control merge conflicts inside the XML; XML with wrong encoding that breaks parsing.","solutions":["Inspect the chained cause to find the exact XML parsing failure (element name, line, value).","Open the .ktr in a text editor and validate the MemoryGroupBy step's XML block; fix or remove malformed attributes/elements.","Re-create the MemoryGroupBy step in Spoon and re-save the transformation to regenerate clean XML.","Check the version of Pentaho used to create the file versus the runtime version; migrate the transformation if schemas differ."],"exampleFix":"// before: ambiguous int parse on possibly-missing node\nint nrValues = Integer.parseInt(XMLHandler.getTagValue(stepnode, \"number_of_values\"));\n\n// after: default when absent\nString nrStr = XMLHandler.getTagValue(stepnode, \"number_of_values\");\nint nrValues = Utils.isEmpty(nrStr) ? 0 : Integer.parseInt(nrStr);","handlingStrategy":"try-catch","validationCode":"// validate XML before loadXML\nString xml = new String(Files.readAllBytes(Paths.get(ktrPath)), StandardCharsets.UTF_8);\nDocument doc = XMLHandler.loadXMLString(xml); // throws early on malformed XML\nNode memGroup = XMLHandler.getSubNode(doc.getDocumentElement(), \"step\");\nif (memGroup == null) throw new IllegalArgumentException(\"No step node for MemoryGroupBy in XML\");","typeGuard":"boolean isParseableStepNode(Node stepnode) {\n  return stepnode != null && XMLHandler.getSubNode(stepnode, \"fields\") != null;\n}","tryCatchPattern":"try {\n  meta.loadXML(stepnode, databases, metaStore);\n} catch (KettleXMLException e) {\n  logError(\"MemoryGroupBy XML load failed: \" + e.getCause(), e);\n  throw e;\n}","preventionTips":["Do not hand-edit .ktr files; regenerate them via Spoon.","Resolve merge conflicts by re-exporting the transformation rather than merging XML by hand.","Verify XML with a parser/linter before loading programmatically.","Keep creator and consumer Pentaho versions compatible."],"tags":["kettle","xml","step-metadata","memory-groupby"],"backgroundTag":"json-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"}