{"record":{"id":"e49d35bb237d8f56","repo":"pentaho/pentaho-kettle","slug":"setvariable0004","errorCode":"SETVARIABLE0004","errorMessage":"Unable to read step information from XML","messagePattern":"Unable to read step information from XML","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/setvariable/SetVariableMeta.java","lineNumber":217,"sourceCode":"      Node fields = XMLHandler.getSubNode( stepnode, \"fields\" );\n      int count = XMLHandler.countNodes( fields, \"field\" );\n\n      allocate( count );\n\n      for ( int i = 0; i < count; i++ ) {\n        Node fnode = XMLHandler.getSubNodeByNr( fields, \"field\", i );\n\n        fieldName[i] = XMLHandler.getTagValue( fnode, \"field_name\" );\n        variableName[i] = XMLHandler.getTagValue( fnode, \"variable_name\" );\n        variableType[i] = getVariableType( XMLHandler.getTagValue( fnode, \"variable_type\" ) );\n        defaultValue[i] = XMLHandler.getTagValue( fnode, \"default_value\" );\n      }\n\n      // Default to \"N\" for backward compatibility\n      //\n      usingFormatting = \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, \"use_formatting\" ) );\n    } catch ( Exception e ) {\n      throw new KettleXMLException( BaseMessages.getString(\n        PKG, \"SetVariableMeta.RuntimeError.UnableToReadXML.SETVARIABLE0004\" ), e );\n    }\n  }\n\n  public void setDefault() {\n    int count = 0;\n\n    allocate( count );\n\n    for ( int i = 0; i < count; i++ ) {\n      fieldName[i] = \"field\" + i;\n      variableName[i] = \"\";\n      variableType[i] = VARIABLE_TYPE_JVM;\n      defaultValue[i] = \"\";\n    }\n\n    usingFormatting = true;\n  }","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/setvariable/SetVariableMeta.java#L199-L235","documentation":"SetVariableMeta.loadXML delegates to readData to parse the step's <fields> XML. Any exception while reading tags (field names, variable names, variable types, defaults, use_formatting) is wrapped in a KettleXMLException with message SETVARIABLE0004, meaning the step's XML definition could not be parsed.","triggerScenarios":"loadXML is called with a stepnode whose expected tags are missing/malformed, or XMLHandler.getTagValue throws during parsing.","commonSituations":"Hand-edited or truncated .ktr XML; importing a transformation produced by a different PDI version with changed tags; copy-paste corruption inside the step's XML node.","solutions":["Open the .ktr in a text editor and repair/validate the <step> XML for SetVariable, especially <fields> and <use_formatting>","Re-create the Set Variable step in Spoon and re-save the transformation","Check PDI version compatibility and re-export the transformation with the current version","Inspect the wrapped cause exception in the log for the exact parse failure"],"exampleFix":"// before (broken XML)\n<fields>\n  <field>\n    <name>amount</name>\n<!-- missing variable_name -->\n</fields>\n// after\n<fields>\n  <field>\n    <name>amount</name>\n    <variable_name>AMOUNT</variable_name>\n    <variable_type>0</variable_type>\n    <default_value></default_value>\n  </field>\n</fields>","handlingStrategy":"try-catch","validationCode":"try (InputStream is = new FileInputStream(ktrFile)) {\n  Document doc = XMLHandler.loadXMLFile(is);\n  // verify <step> nodes of type SetVariable contain <fields> children before loading meta\n}","typeGuard":null,"tryCatchPattern":"try { loadXML(...); } catch (KettleXMLException e) { if (e.getMessage().contains(\"SETVARIABLE0004\")) { /* fall back to re-creating the step or repairing XML */ log(\"SetVariable XML unreadable: \", e.getCause()); } else throw e; }","preventionTips":["Do not hand-edit .ktr XML; use Spoon","Keep transformations under version control to detect corruption","Validate XML with the PDI schema after version migrations"],"tags":["kettle","pdi","xml","metadata","deserialization"],"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"}