pentaho/pentaho-kettle · error · KettleXMLException

TableExistsMeta.Exception.UnableToReadStepInfo

Error message

TableExistsMeta.Exception.UnableToReadStepInfo

What it means

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.

Solutions

  1. Inspect the chained cause to find the exact XML parsing failure
  2. Validate the .ktr XML well-formedness (e.g. xmllint) and repair broken tags
  3. Ensure the <connection> element for id_connection exists in the file
  4. Re-export the transformation from Spoon on the source system

Example fix

// before: hand-edited broken node
<tablenamefield></ tablenamefield>
// after
<tablenamefield>tablename</tablenamefield>
Defensive patterns

Strategy: try-catch

Validate before calling

// validate XML before loading
Document doc = XMLHandler.loadXMLFile(new File(ktrPath));
if (doc == null || XMLHandler.getSubNode(doc, "transformation") == null) {
  throw new IllegalStateException("Invalid or truncated .ktr file");
}

Try / catch

try { transMeta = new TransMeta(ktrPath); }
catch (KettleXMLException e) {
  logError("XML load failed: " + e.getCause());
  // re-export from source or repair the step's XML node
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/250ff81c2dd4c577. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExistsMeta.java:166

    retval.append( "    " + XMLHandler.addTagValue( "connection", databaseMeta == null ? "" : databaseMeta.getName() ) );
    retval.append( "    " + XMLHandler.addTagValue( "tablenamefield", tablenamefield ) );
    retval.append( "    " + XMLHandler.addTagValue( "resultfieldname", resultfieldname ) );
    retval.append( "    " + XMLHandler.addTagValue( "schemaname", schemaname ) );

    return retval.toString();
  }

  private void readData( Node stepnode, List<DatabaseMeta> databases ) throws KettleXMLException {
    try {
      String con = XMLHandler.getTagValue( stepnode, "connection" );
      databaseMeta = DatabaseMeta.findDatabase( databases, con );
      tablenamefield = XMLHandler.getTagValue( stepnode, "tablenamefield" );
      resultfieldname = XMLHandler.getTagValue( stepnode, "resultfieldname" );
      schemaname = XMLHandler.getTagValue( stepnode, "schemaname" );

    } catch ( Exception e ) {
      throw new KettleXMLException(
        BaseMessages.getString( PKG, "TableExistsMeta.Exception.UnableToReadStepInfo" ), e );
    }
  }

  public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
    try {
      databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
      tablenamefield = rep.getStepAttributeString( id_step, "tablenamefield" );
      schemaname = rep.getStepAttributeString( id_step, "schemaname" );

      resultfieldname = rep.getStepAttributeString( id_step, "resultfieldname" );
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "TableExistsMeta.Exception.UnexpectedErrorReadingStepInfo" ), e );
    }
  }

  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {

View on GitHub (pinned to f3058517a1)