{"record":{"id":"805965adac9a1bae","repo":"pentaho/pentaho-kettle","slug":"jobentrywaitforsql-unableloadxml","errorCode":null,"errorMessage":"JobEntryWaitForSQL.UnableLoadXML","messagePattern":"JobEntryWaitForSQL\\.UnableLoadXML","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/waitforsql/JobEntryWaitForSQL.java","lineNumber":252,"sourceCode":"      super.loadXML( entrynode, databases, slaveServers );\n      String dbname = XMLHandler.getTagValue( entrynode, \"connection\" );\n      connection = DatabaseMeta.findDatabase( databases, dbname );\n      schemaname = XMLHandler.getTagValue( entrynode, \"schemaname\" );\n      tablename = XMLHandler.getTagValue( entrynode, \"tablename\" );\n      successCondition =\n        getSucessConditionByCode( Const.NVL( XMLHandler.getTagValue( entrynode, \"success_condition\" ), \"\" ) );\n      rowsCountValue = Const.NVL( XMLHandler.getTagValue( entrynode, \"rows_count_value\" ), \"0\" );\n      iscustomSQL = \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, \"is_custom_sql\" ) );\n      isUseVars = \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, \"is_usevars\" ) );\n      customSQL = XMLHandler.getTagValue( entrynode, \"custom_sql\" );\n      isAddRowsResult = \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, \"add_rows_result\" ) );\n      maximumTimeout = XMLHandler.getTagValue( entrynode, \"maximum_timeout\" );\n      checkCycleTime = XMLHandler.getTagValue( entrynode, \"check_cycle_time\" );\n      successOnTimeout = \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, \"success_on_timeout\" ) );\n      isClearResultList = \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, \"clear_result_rows\" ) );\n\n    } catch ( KettleException e ) {\n      throw new KettleXMLException( BaseMessages.getString( PKG, \"JobEntryWaitForSQL.UnableLoadXML\" ), e );\n    }\n  }\n\n  @Override\n  public void loadRep( Repository rep, IMetaStore metaStore, ObjectId id_jobentry, List<DatabaseMeta> databases,\n    List<SlaveServer> slaveServers ) throws KettleException {\n    try {\n      connection = rep.loadDatabaseMetaFromJobEntryAttribute( id_jobentry, \"connection\", \"id_database\", databases );\n\n      schemaname = rep.getJobEntryAttributeString( id_jobentry, \"schemaname\" );\n      tablename = rep.getJobEntryAttributeString( id_jobentry, \"tablename\" );\n      successCondition =\n        getSuccessConditionByCode( Const.NVL(\n          rep.getJobEntryAttributeString( id_jobentry, \"success_condition\" ), \"\" ) );\n      rowsCountValue = rep.getJobEntryAttributeString( id_jobentry, \"rows_count_value\" );\n      iscustomSQL = rep.getJobEntryAttributeBoolean( id_jobentry, \"is_custom_sql\" );\n      isUseVars = rep.getJobEntryAttributeBoolean( id_jobentry, \"is_usevars\" );\n      isAddRowsResult = rep.getJobEntryAttributeBoolean( id_jobentry, \"add_rows_result\" );","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/waitforsql/JobEntryWaitForSQL.java#L234-L270","documentation":"JobEntryWaitForSQL.loadXML() wraps a KettleException raised while parsing the 'wait for SQL' entry's XML into a KettleXMLException with the localized message 'JobEntryWaitForSQL.UnableLoadXML'. It means the XML node for this job entry (connection, SQL script, timeouts, flags) could not be parsed.","triggerScenarios":"Calling loadXML(...) with an entrynode that is missing required sub-nodes (e.g. <connection>, <sql>, 'maximum_timeout', 'clear_result_rows') or contains invalid values, so XMLHandler throws KettleException.","commonSituations":"Hand-edited or partial .kjb files; XML exported from a newer Kettle with attributes this version cannot parse; corrupted export files; renamed tags across versions.","solutions":["Open the .kjb and repair the <entry type='WAIT_FOR_SQL'> node; compare against a working job from the same version.","Recreate the Wait For SQL entry in Spoon so valid XML is written.","Use e.getCause() to pinpoint which XMLHandler call failed and which tag is at fault.","Ensure the Kettle version reading the file matches (or is newer than) the version that wrote it."],"exampleFix":"// before: missing connection node in .kjb\n<entry type='WAIT_FOR_SQL'><sql>select 1</sql></entry>\n// after\n<entry type='WAIT_FOR_SQL'><connection>prod_db</connection><sql>select 1</sql></entry>","handlingStrategy":"try-catch","validationCode":"// Validate wait-for-SQL XML structure before loadXML\nif ( XMLHandler.getSubNode(entrynode, \"connection\") == null )\n  throw new KettleXMLException(\"wait-for-sql entry missing <connection>\");\nif ( XMLHandler.getTagValue(entrynode, \"sql\") == null )\n  throw new KettleXMLException(\"wait-for-sql entry missing <sql>\");","typeGuard":"boolean isValidWaitForSqlNode(Node entrynode) {\n  return entrynode != null\n    && XMLHandler.getSubNode(entrynode, \"connection\") != null\n    && XMLHandler.getTagValue(entrynode, \"sql\") != null;\n}","tryCatchPattern":"try {\n  jobEntry.loadXML(entrynode, databases, slaveServers, rep, metaStore);\n} catch ( KettleXMLException e ) {\n  logError(\"Wait-for-SQL XML load failed: \" + e.getCause().getMessage(), e);\n  // abort job load or substitute a corrected node\n}","preventionTips":["Author jobs in Spoon; never hand-edit the WAIT_FOR_SQL XML block.","Confirm reader Kettle version supports tags written by the authoring version.","Diff suspect .kjb files against a known-good job.","Catch KettleXMLException and inspect the cause to locate the broken tag."],"tags":["xml","serialization","kettle","sql","job-entry"],"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"}