{"record":{"id":"5e5ef734fa19fde9","repo":"pentaho/pentaho-kettle","slug":"stringoperationsmeta-exception-unabletoreadstepinfofromxml","errorCode":null,"errorMessage":"StringOperationsMeta.Exception.UnableToReadStepInfoFromXML","messagePattern":"StringOperationsMeta\\.Exception\\.UnableToReadStepInfoFromXML","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/stringoperations/StringOperationsMeta.java","lineNumber":422,"sourceCode":"      for ( int i = 0; i < nrkeys; i++ ) {\n        Node fnode = XMLHandler.getSubNodeByNr( lookup, \"field\", i );\n\n        fieldInStream[i] = Const.NVL( XMLHandler.getTagValue( fnode, \"in_stream_name\" ), \"\" );\n        fieldOutStream[i] = Const.NVL( XMLHandler.getTagValue( fnode, \"out_stream_name\" ), \"\" );\n\n        trimType[i] = Const.NVL( XMLHandler.getTagValue( fnode, \"trim_type\" ), \"\" );\n        lowerUpper[i] = Const.NVL( XMLHandler.getTagValue( fnode, \"lower_upper\" ), \"\" );\n        padding_type[i] = Const.NVL( XMLHandler.getTagValue( fnode, \"padding_type\" ), \"\" );\n        padChar[i] = Const.NVL( XMLHandler.getTagValue( fnode, \"pad_char\" ), \"\" );\n        padLen[i] = Const.NVL( XMLHandler.getTagValue( fnode, \"pad_len\" ), \"\" );\n        initCap[i] = Const.NVL( XMLHandler.getTagValue( fnode, \"init_cap\" ), \"\" );\n        maskXML[i] = Const.NVL( XMLHandler.getTagValue( fnode, \"mask_xml\" ), \"\" );\n        digits[i] = Const.NVL( XMLHandler.getTagValue( fnode, \"digits\" ), \"\" );\n        remove_special_characters[i] = Const.NVL( XMLHandler.getTagValue( fnode, \"remove_special_characters\" ), \"\" );\n\n      }\n    } catch ( Exception e ) {\n      throw new KettleXMLException( BaseMessages.getString(\n        PKG, \"StringOperationsMeta.Exception.UnableToReadStepInfoFromXML\" ), e );\n    }\n  }\n\n  @Override\n  public void setDefault() {\n    fieldInStream = null;\n    fieldOutStream = null;\n\n    int nrkeys = 0;\n\n    allocate( nrkeys );\n  }\n\n  @Override\n  public String getXML() {\n    StringBuilder retval = new StringBuilder( 500 );\n","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/stringoperations/StringOperationsMeta.java#L404-L440","documentation":"StringOperationsMeta throws this KettleXMLException in readData() (called from loadXML) when parsing the step's XML definition fails unexpectedly. The wrapper keeps the original exception as the cause. The step cannot be loaded from the .ktr until the XML structure is corrected.","triggerScenarios":"Calling loadXML() when XMLHandler.getTagValue(fnode, ...) or the field-array setup throws — malformed <fields>/<field> nodes, unexpected null elements, or DOM errors while reading field_in/mask_xml/digits/remove_special_characters tags.","commonSituations":"Hand-edited or truncated .ktr XML; XML generated by a different PDI version with a diverged schema; corrupted file after a bad merge or transfer.","solutions":["Inspect the wrapped cause to pinpoint the malformed XML element","Repair the <fields><field> section of the step XML so each field node has the expected tags","Regenerate the step XML by re-saving it from Spoon","Restore the .ktr from version control or backup"],"exampleFix":"// before\n<field><field_in>a</field_in> <!-- missing required child tags -->\n// after\n<field><field_in>a</field_in><field_out>b</field_out><trim_type>none</trim_type><mask_xml></mask_xml><digits>none</digits><remove_special_characters>none</remove_special_characters></field>","handlingStrategy":"try-catch","validationCode":"// check the fields node before loadXML\nNode fieldsNode = XMLHandler.getSubNode(stepnode, \"fields\");\nif (fieldsNode == null) {\n  logBasic(\"No fields node; step will use defaults\");\n}\nfor (int i = 0; fieldsNode != null && i < XMLHandler.countNodes(fieldsNode, \"field\"); i++) {\n  Node f = XMLHandler.getSubNodeByNr(fieldsNode, \"field\", i);\n  if (XMLHandler.getTagValue(f, \"field_in\") == null) {\n    throw new IllegalArgumentException(\"Missing field_in at field #\" + i);\n  }\n}","typeGuard":"boolean isParsableFieldsNode(Node stepnode) {\n  Node fields = XMLHandler.getSubNode(stepnode, \"fields\");\n  return fields == null || XMLHandler.countNodes(fields, \"field\") >= 0;\n}","tryCatchPattern":"try {\n  meta.loadXML(stepnode, databases, context);\n} catch (KettleXMLException e) {\n  logError(\"Bad StringOperations XML: \" + e.getCause(), e);\n  meta.setDefault(); // degrade gracefully\n}","preventionTips":["Edit step XML only through Spoon, never manually","Validate .ktr XML well-formedness before loading","Restore corrupted files from version control or backups","Compare against a known-good step XML when upgrading PDI versions"],"tags":["xml","metadata-load","pdi","ktr"],"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"}