{"record":{"id":"daa48601a9783f66","repo":"pentaho/pentaho-kettle","slug":"tableexists-meta-unableloadxml","errorCode":null,"errorMessage":"TableExists.Meta.UnableLoadXml","messagePattern":"TableExists\\.Meta\\.UnableLoadXml","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/tableexists/JobEntryTableExists.java","lineNumber":96,"sourceCode":"    retval.append( \"      \" ).append( XMLHandler.addTagValue( \"tablename\", tablename ) );\n    retval.append( \"      \" ).append( XMLHandler.addTagValue( \"schemaname\", schemaname ) );\n    retval.append( \"      \" ).append(\n      XMLHandler.addTagValue( \"connection\", connection == null ? null : connection.getName() ) );\n\n    return retval.toString();\n  }\n\n  public void loadXML( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers,\n    Repository rep, IMetaStore metaStore ) throws KettleXMLException {\n    try {\n      super.loadXML( entrynode, databases, slaveServers );\n\n      tablename = XMLHandler.getTagValue( entrynode, \"tablename\" );\n      schemaname = XMLHandler.getTagValue( entrynode, \"schemaname\" );\n      String dbname = XMLHandler.getTagValue( entrynode, \"connection\" );\n      connection = DatabaseMeta.findDatabase( databases, dbname );\n    } catch ( KettleException e ) {\n      throw new KettleXMLException( BaseMessages.getString( PKG, \"TableExists.Meta.UnableLoadXml\" ), e );\n    }\n  }\n\n  public void loadRep( Repository rep, IMetaStore metaStore, ObjectId id_jobentry, List<DatabaseMeta> databases,\n    List<SlaveServer> slaveServers ) throws KettleException {\n    try {\n      tablename = rep.getJobEntryAttributeString( id_jobentry, \"tablename\" );\n      schemaname = rep.getJobEntryAttributeString( id_jobentry, \"schemaname\" );\n\n      connection = rep.loadDatabaseMetaFromJobEntryAttribute( id_jobentry, \"connection\", \"id_database\", databases );\n    } catch ( KettleDatabaseException dbe ) {\n      throw new KettleException(\n        BaseMessages.getString( PKG, \"TableExists.Meta.UnableLoadRep\", \"\" + id_jobentry ), dbe );\n    }\n  }\n\n  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ) throws KettleException {\n    try {","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/tableexists/JobEntryTableExists.java#L78-L114","documentation":"JobEntryTableExists.loadXML wraps any KettleException raised while parsing the job entry's XML node (tablename, schemaname, connection tags) into a KettleXMLException with the localized 'TableExists.Meta.UnableLoadXml' message and the original as cause. It indicates the XML representation of this entry could not be deserialized.","triggerScenarios":"Calling loadXML with a malformed entrynode: XMLHandler.getTagValue or DatabaseMeta.findDatabase throws, e.g. the node's nested content is invalid or the databases list processing fails.","commonSituations":"A hand-edited or truncated .kjb file missing/broken tags; the <connection> name refers to a database meta removed from the shared XML (findDatabase returning null is tolerated, but exceptions during parsing are not); version downgrade producing unexpected XML structure.","solutions":["Open the .kjb file in a text editor and validate the <entry type=\"TABLE_EXISTS\"> XML block is well-formed","Restore the job file from version control or an earlier good copy","Load the job in Spoon and re-save it to regenerate clean XML","Check the chained cause (e) in the KettleXMLException for the exact parsing error and line","If a connection lookup is the problem, ensure the database connection is defined in the job/shared XML"],"exampleFix":"// before: hand-edited XML with broken tag\n<tablename>&db_table</tablename> <!-- unescaped & -->\n// after\n<tablename>my_table</tablename>","handlingStrategy":"try-catch","validationCode":"// Java: sanity-check the XML node before loadXML\nif (entrynode == null || XMLHandler.getTagValue(entrynode, \"connection\") == null\n    && XMLHandler.getTagValue(entrynode, \"tablename\") == null) {\n  throw new KettleXMLException(\"TABLE_EXISTS entry node missing required tags\");\n}","typeGuard":"if (entrynode != null && \"TABLE_EXISTS\".equals(XMLHandler.getTagValue(entrynode, \"type\"))) { /* safe */ }","tryCatchPattern":"try {\n  entry.loadXML(entrynode, databases, slaveServers, rep, metaStore);\n} catch (KettleXMLException e) {\n  logError(\"TableExists XML load failed: \" + e.getCause(), e);\n  // fall back to defaults or abort job load\n}","preventionTips":["Validate .kjb files as XML after manual edits","Keep job files in version control with clean merges","Avoid loading files produced by newer Pentaho versions into older ones","Ensure referenced database connections exist in shared/job XML"],"tags":["pentaho-kettle","xml","job-entry"],"backgroundTag":"xml-parse-failed","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"}