pentaho/pentaho-kettle · error · KettleDatabaseException

Unexpected error checking whether or not sequence [" +…

Error message

Unexpected error checking whether or not sequence [" + schemaSequence + "] exists

What it means

Raised by getCheckSumSequence-style sequence existence checks (Oracle) when any unexpected Exception occurs while probing the sequence. It wraps the cause and names the schema-qualified sequence that was being checked.

Solutions

  1. Confirm you are connected to Oracle; sequence checks are Oracle-specific
  2. Ensure the user can read USER_SEQUENCES/ALL_SEQUENCES dictionary views
  3. Reconnect if the session died, then retry the check
  4. Verify the schema and sequence name spelling/casing

Example fix

// before
boolean s = db.checkSequenceExists("MYSCHEMA", "MYSEQ"); // on PostgreSQL
// after
if (meta.getDatabaseInterface() instanceof OracleDatabaseMeta) {
  boolean s = db.checkSequenceExists("MYSCHEMA", "MYSEQ");
}
Defensive patterns

Strategy: validation

Validate before calling

// Oracle-only check
if (!(dbMeta.getDatabaseInterface() instanceof OracleDatabaseMeta)) {
  throw new UnsupportedOperationException("sequence checks are Oracle-only");
}

Type guard

boolean isOracle(DatabaseMeta meta) {
  return "Oracle".equals(meta.getPluginId());
}

Try / catch

try {
  boolean exists = db.checkSequenceExists(schema, seq);
} catch (KettleDatabaseException e) {
  log.error("sequence probe failed: " + e.getCause(), e);
}

Prevention

When it happens

Trigger: Exception during the sequence-existence SELECT (e.g. FROM user_sequences/all_sequences query) inside the try block, such as connection failure or driver error.

Common situations: Checking sequences on non-Oracle databases via the Oracle-only path, missing SELECT privileges on data dictionary views, or dead connections.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/database/Database.java:2405

      return retval;
    }

    String schemaSequence = databaseMeta.getQuotedSchemaTableCombination( schemaName, sequenceName );
    try {
      //
      // Get the info from the data dictionary...
      //
      String sql = databaseMeta.getSQLSequenceExists( schemaSequence );
      ResultSet res = openQuery( sql );
      if ( res != null ) {
        Object[] row = getRow( res );
        if ( row != null ) {
          retval = true;
        }
        closeQuery( res );
      }
    } catch ( Exception e ) {
      throw new KettleDatabaseException( "Unexpected error checking whether or not sequence ["
        + schemaSequence + "] exists", e );
    }

    return retval;
  }

  /**
   * Check if an index on certain fields in a table exists.
   *
   * @param tableName The table on which the index is checked
   * @param idxFields The fields on which the index is checked
   * @return True if the index exists
   */
  public boolean checkIndexExists( String tableName, String[] idxFields ) throws KettleDatabaseException {
    return checkIndexExists( null, tableName, idxFields );
  }

  /**

View on GitHub (pinned to f3058517a1)