{"record":{"id":"250ff81c2dd4c577","repo":"pentaho/pentaho-kettle","slug":"tableexistsmeta-exception-unabletoreadstepinfo","errorCode":null,"errorMessage":"TableExistsMeta.Exception.UnableToReadStepInfo","messagePattern":"TableExistsMeta\\.Exception\\.UnableToReadStepInfo","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExistsMeta.java","lineNumber":166,"sourceCode":"\n    retval.append( \"    \" + XMLHandler.addTagValue( \"connection\", databaseMeta == null ? \"\" : databaseMeta.getName() ) );\n    retval.append( \"    \" + XMLHandler.addTagValue( \"tablenamefield\", tablenamefield ) );\n    retval.append( \"    \" + XMLHandler.addTagValue( \"resultfieldname\", resultfieldname ) );\n    retval.append( \"    \" + XMLHandler.addTagValue( \"schemaname\", schemaname ) );\n\n    return retval.toString();\n  }\n\n  private void readData( Node stepnode, List<DatabaseMeta> databases ) throws KettleXMLException {\n    try {\n      String con = XMLHandler.getTagValue( stepnode, \"connection\" );\n      databaseMeta = DatabaseMeta.findDatabase( databases, con );\n      tablenamefield = XMLHandler.getTagValue( stepnode, \"tablenamefield\" );\n      resultfieldname = XMLHandler.getTagValue( stepnode, \"resultfieldname\" );\n      schemaname = XMLHandler.getTagValue( stepnode, \"schemaname\" );\n\n    } catch ( Exception e ) {\n      throw new KettleXMLException(\n        BaseMessages.getString( PKG, \"TableExistsMeta.Exception.UnableToReadStepInfo\" ), e );\n    }\n  }\n\n  public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {\n    try {\n      databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, \"id_connection\", databases );\n      tablenamefield = rep.getStepAttributeString( id_step, \"tablenamefield\" );\n      schemaname = rep.getStepAttributeString( id_step, \"schemaname\" );\n\n      resultfieldname = rep.getStepAttributeString( id_step, \"resultfieldname\" );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"TableExistsMeta.Exception.UnexpectedErrorReadingStepInfo\" ), e );\n    }\n  }\n\n  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExistsMeta.java#L148-L184","documentation":"TableExistsMeta.readData (invoked from loadXML) wraps any exception from parsing the step's XML node (loading connection, tablenamefield, resultfieldname, schemaname tags) into a KettleXMLException. It means the .ktr file's XML for this TableExists step is malformed or unreadable.","triggerScenarios":"Loading a .ktr via loadXML/TransMeta constructor when XMLHandler.getTagValue calls or DatabaseMeta.findDatabase throw — truncated file, hand-edited XML, missing/invalid <connection> reference, or wrong encoding.","commonSituations":"Manually editing a .ktr and breaking a tag; merging transformations with tools that corrupt XML; a database connection referenced in the step that fails to resolve; partial file transfer truncating the XML.","solutions":["Inspect the chained cause to find the exact XML parsing failure","Validate the .ktr XML well-formedness (e.g. xmllint) and repair broken tags","Ensure the <connection> element for id_connection exists in the file","Re-export the transformation from Spoon on the source system"],"exampleFix":"// before: hand-edited broken node\n<tablenamefield></ tablenamefield>\n// after\n<tablenamefield>tablename</tablenamefield>","handlingStrategy":"try-catch","validationCode":"// validate XML before loading\nDocument doc = XMLHandler.loadXMLFile(new File(ktrPath));\nif (doc == null || XMLHandler.getSubNode(doc, \"transformation\") == null) {\n  throw new IllegalStateException(\"Invalid or truncated .ktr file\");\n}","typeGuard":null,"tryCatchPattern":"try { transMeta = new TransMeta(ktrPath); }\ncatch (KettleXMLException e) {\n  logError(\"XML load failed: \" + e.getCause());\n  // re-export from source or repair the step's XML node\n}","preventionTips":["Do not hand-edit .ktr files; edit in Spoon instead","Validate exported XML with xmllint before archiving","Ensure connections referenced by steps exist in the file/repo"],"tags":["kettle","xml","persistence","step-metadata"],"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"}